Manages fast "alchemy memory"

Variables

read onlybytesFree:Int

Returns the total number of free bytes (allocated but unused).

bytesTotal:Int

Returns the total number of allocated bytes.

bytesUsed:Int

Returns the total number of used bytes.

read onlysize:Int

The total number of ArrayAccess objects that have access to the heap.

Methods

dealloc (access:MemoryAccess):Void

Deallocates the memory used by access.

defrag ():Void

Performs a full defragmentation of the allocated memory.

malloc (access:MemoryAccess, numBytes:Int):Void

Copies n bytes from the location pointed by the index source to the location pointed by the index destination.

Copying takes place as if an intermediate buffer was used, allowing the destination and source to overlap.

See:

pack ():Void

Releases unused memory.

realloc (access:MemoryAccess, numBytes:Int):Void

Resizes access to match numBytes.

toString ():String

Static variables

staticAUTO_RECLAIM_INTERVAL:Float

The update rate in seconds for the weak reference monitor that detects GCed MemoryAccess objects.

A smaller value requires more CPU time but releases memory earlier.

The default value is 0.25 seconds.

staticAUTO_RECLAIM_MEMORY:Bool

If true, allocated memory will be automatically freed when the reference to a MemoryAccess object is garbage collected.

staticBLOCK_SIZE_BYTES:Int

The minimum block size for allocating additional memory on the fly.

The default value is 64 KiB. The minimum value is 1024 bytes or 1 KiB.

Changing this value has no effect after memory has been allocated for the first time.

staticMEMORY_LIMIT_BYTES:Int

The total number bytes that the user is allowed to allocate (1 MiB equals 1.048.576 bytes).

This should be used as a safe upper limit for detecting memory leaks during development.

The default value is 64 MiB.

staticRAW_BYTES:Int

A reserved, fixed portion of bytes at the beginning of the byte array which can be used as a temporary buffer or for doing math tricks.

Changing this value has no effect after memory has been allocated for the first time.

staticRESERVE_BYTES:Int

The total number of bytes that are preallocated prior to the first call to malloc().

Default is 0 bytes.

staticread onlyinstance:MemoryManager

Static methods

staticfree ():Void

Releases all allocated memory and nullifies references for GC'ing used resources.