【发布时间】:2016-08-11 16:47:01
【问题描述】:
SharedFreeList 有正确的方法,但我不知道如何释放 FreeList 的所有节点:
module runnable;
import std.experimental.allocator.building_blocks;
import std.experimental.allocator.mallocator;
import std.experimental.allocator;
shared SharedFreeList!(Mallocator, 0, unbounded) heap1;
FreeList!(Mallocator, 0, unbounded) heap2;
shared static ~this()
{
heap1.deallocateAll; // OK
}
static ~this()
{
heap2.deallocateAll; // no prop deallocateAll for...
}
虽然这个例子没有意义,但我可能想在类析构函数中做同样的事情。使用某些静态参数,FreeList.deallocateAll 似乎被停用了,但是必须有一种方法可以释放列表中的所有节点,对吧?
【问题讨论】:
标签: memory-management d allocation