libphobos/testsuite/libphobos.phobos/std_experimental_allocator_showcase.d
raw| 1 | @system unittest |
| 2 | { |
| 3 | import std.experimental.allocator.showcase; |
| 4 | |
| 5 | StackFront!4096 a; |
| 6 | auto b = a.allocate(4000); |
| 7 | assert(b.length == 4000); |
| 8 | auto c = a.allocate(4000); |
| 9 | assert(c.length == 4000); |
| 10 | a.deallocate(b); |
| 11 | a.deallocate(c); |
| 12 | } |
| 13 | |
| 14 | @system unittest |
| 15 | { |
| 16 | import std.experimental.allocator.showcase; |
| 17 | |
| 18 | auto alloc = mmapRegionList(1024 * 1024); |
| 19 | const b = alloc.allocate(100); |
| 20 | assert(b.length == 100); |
| 21 | } |
| 22 |