-
-
Notifications
You must be signed in to change notification settings - Fork 33
Manual Memory Management
Timur Gafarov edited this page Jul 2, 2015
·
12 revisions
From version 0.5.0, dlib supports manual memory management (MMM) based on standard C malloc/free. You can use the module dlib.core.memory
to allocate classes, structs and arrays in unmanaged heap:
import dlib.core.memory;
class MyClass
{
int x;
this(int x)
{
this.x = x;
}
}
MyClass obj = New!MyClass(99);
assert(obj.x == 99);
Delete(obj);
int[] arr = New!(int[])(100);
assert(arr.length == 100);
Delete(arr);