| 1 |
@system unittest |
| 2 |
{ |
| 3 |
import std.experimental.allocator.building_blocks.bucketizer; |
| 4 |
|
| 5 |
import std.algorithm.comparison : max; |
| 6 |
import std.experimental.allocator.building_blocks.allocator_list : AllocatorList; |
| 7 |
import std.experimental.allocator.building_blocks.free_list : FreeList; |
| 8 |
import std.experimental.allocator.building_blocks.region : Region; |
| 9 |
import std.experimental.allocator.common : unbounded; |
| 10 |
import std.experimental.allocator.mallocator : Mallocator; |
| 11 |
import std.typecons : Ternary; |
| 12 |
Bucketizer!( |
| 13 |
FreeList!( |
| 14 |
AllocatorList!( |
| 15 |
(size_t n) => Region!Mallocator(max(n, 1024 * 1024))), |
| 16 |
0, unbounded), |
| 17 |
65, 512, 64) a; |
| 18 |
auto b = a.allocate(400); |
| 19 |
assert(b.length == 400); |
| 20 |
assert(a.owns(b) == Ternary.yes); |
| 21 |
a.deallocate(b); |
| 22 |
} |
| 23 |
|