Using allocatedInCurrentThread
ulong currentlyAllocated = GC.allocatedInCurrentThread(); struct DataStruct { long l1; long l2; long l3; long l4; } DataStruct* unused = new DataStruct; assert(GC.allocatedInCurrentThread() == currentlyAllocated + 32); assert(GC.stats().allocatedInCurrentThread == currentlyAllocated + 32);
Returns the number of bytes allocated for the current thread since program start. It is the same as GC.stats().allocatedInCurrentThread, but faster.