如何释放 FreeList 的所有项目?

How can i free all the items of a FreeList?

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...
}

虽然这个例子毫无意义,但我可能想在 class 析构函数中做同样的事情。使用某些静态参数,FreeList.deallocateAll 似乎已停用,但是必须有一种方法可以解除分配列表中的所有节点,对吗?

根据DOC

Defined only if ParentAllocator defines deallocateAll. If so, forwards to it and resets the freelist.

您使用的 Mallocator 没有 deallocateAll 所以您不能使用它。但是 SharedFreeList 有自己的实现 deallocateAll.

所以我可能会在 https://issues.dlang.org 上创建一个问题。因为我相信同样的方法也可以用于 FreeList