record PrefixedArray[P, T] ( prefix:P, data:Array[T,0], ); [P, T] allocatePrefixedArray(static P, static T, arrayElementsCount) { var ptr = libc.malloc(TypeSize(PrefixedArray[P,T]) + TypeSize(T)*arrayElementsCount); return Pointer[PrefixedArray[P,T]](ptr); } [P, T] freePrefixedArray(ptr: Pointer[PrefixedArray[P, T]]) { libc.free(RawPointer(ptr)); }