TracingAllocator class

A debugging (tracing) native memory allocator.

Keeps track of each allocation and release of native memory. Can be queried for statistics. Obviously it's less efficient than a naked calloc, so it's supposed to be used only for debugging / profiling. Example code using this allocator can be found in example/fbdb/ex_11_mem_benchmark.dart.

Implemented types
Available extensions

Constructors

TracingAllocator()

Properties

alloc Allocator
The actual allocator
getter/setter pair
allocated int
Total currently allocated memory.
getter/setter pair
allocatedBlocks Map<int, int>
All currently allocated native memory blocks.
getter/setter pair
allocatedSum int
The sum of all allocated memory.
getter/setter pair
allocationCount int
The number of allocations (calls to allocate).
getter/setter pair
freeCount int
The number of releases (calls to free).
getter/setter pair
freedSum int
Total freed memory.
getter/setter pair
hashCode int
The hash code for this object.
no setterinherited
maxAllocated int
The maximum allocated memory up to date.
getter/setter pair
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

allocate<T extends NativeType>(int byteCount, {int? alignment}) Pointer<T>
Allocates a native memory block of the given size, updating the statistics.
override
call<T extends SizedNativeType>([int count = 1]) Pointer<T>

Available on Allocator, provided by the AllocatorAlloc extension

Allocates sizeOf<T>() * count bytes of memory using allocate.
free(Pointer<NativeType> pointer) → void
Frees up a native memory block, updating the statistics.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toMap() Map<String, int>
Returns a structured representation of the current memory statistics.
toString() String
Returns the textual representation of the current memory statistics.
override

Operators

operator ==(Object other) bool
The equality operator.
inherited