| 1 |
pure @system unittest |
| 2 |
{ |
| 3 |
import std.experimental.allocator.gc_allocator; |
| 4 |
|
| 5 |
auto buffer = GCAllocator.instance.allocate(1024 * 1024 * 4); |
| 6 |
// deallocate upon scope's end (alternatively: leave it to collection) |
| 7 |
scope(exit) GCAllocator.instance.deallocate(buffer); |
| 8 |
//... |
| 9 |
} |
| 10 |
|