TempAlloc.malloc - multiple declarations

Function TempAlloc.malloc

Allocates nbytes bytes on the TempAlloc stack. NOT safe for real-time programming, since if there's not enough space on the current block, a new one will automatically be created. Also, very large objects (currently over 4MB) will simply be heap-allocated.

static void* malloc (
  ulong nbytes
);

Bugs

Memory allocated by TempAlloc is not scanned by the GC. This is necessary for performance and to avoid false pointer issues. Do not store the only reference to a GC-allocated object in TempAlloc-allocated memory.

Function TempAlloc.malloc

Same as malloc() but uses stateCopy cached on stack by caller to avoid a thread-local storage lookup. Strictly a speed hack.

static void* malloc (
  ulong nbytes,
  scid.core.memory.TempAlloc.State stateCopy
);