| 1 |
@system unittest |
| 2 |
{ |
| 3 |
import std.experimental.allocator.building_blocks.segregator; |
| 4 |
|
| 5 |
import std.experimental.allocator.building_blocks.free_list : FreeList; |
| 6 |
import std.experimental.allocator.gc_allocator : GCAllocator; |
| 7 |
import std.experimental.allocator.mallocator : Mallocator; |
| 8 |
alias A = |
| 9 |
Segregator!( |
| 10 |
1024 * 4, |
| 11 |
Segregator!( |
| 12 |
128, FreeList!(Mallocator, 0, 128), |
| 13 |
GCAllocator), |
| 14 |
Segregator!( |
| 15 |
1024 * 1024, Mallocator, |
| 16 |
GCAllocator) |
| 17 |
); |
| 18 |
A a; |
| 19 |
auto b = a.allocate(200); |
| 20 |
assert(b.length == 200); |
| 21 |
a.deallocate(b); |
| 22 |
} |
| 23 |
|
| 24 |
@system unittest |
| 25 |
{ |
| 26 |
import std.experimental.allocator.building_blocks.segregator; |
| 27 |
|
| 28 |
import std.experimental.allocator.building_blocks.free_list : FreeList; |
| 29 |
import std.experimental.allocator.gc_allocator : GCAllocator; |
| 30 |
import std.experimental.allocator.mallocator : Mallocator; |
| 31 |
alias A = |
| 32 |
Segregator!( |
| 33 |
128, FreeList!(Mallocator, 0, 128), |
| 34 |
1024 * 4, GCAllocator, |
| 35 |
1024 * 1024, Mallocator, |
| 36 |
GCAllocator |
| 37 |
); |
| 38 |
A a; |
| 39 |
auto b = a.allocate(201); |
| 40 |
assert(b.length == 201); |
| 41 |
a.deallocate(b); |
| 42 |
} |
| 43 |
|