libphobos/testsuite/libphobos.phobos/std_experimental_allocator_mallocator.d
raw| 1 | @nogc @system nothrow unittest |
| 2 | { |
| 3 | import std.experimental.allocator.mallocator; |
| 4 | |
| 5 | auto buffer = Mallocator.instance.allocate(1024 * 1024 * 4); |
| 6 | scope(exit) Mallocator.instance.deallocate(buffer); |
| 7 | //... |
| 8 | } |
| 9 | |
| 10 | pure @nogc @system nothrow unittest |
| 11 | { |
| 12 | import std.experimental.allocator.mallocator; |
| 13 | |
| 14 | auto buffer = AlignedMallocator.instance.alignedAllocate(1024 * 1024 * 4, |
| 15 | 128); |
| 16 | scope(exit) AlignedMallocator.instance.deallocate(buffer); |
| 17 | //... |
| 18 | } |
| 19 |