Memory Pools support in Phobos

F. Almeida francisco.m.almeida at gmail.com
Fri Nov 12 00:57:42 PST 2010


A short question.

Currently, there are plans to deprecate the original manual memory management features (as borrowed from C++), because unlike C++, D has built-in GC. The library provided alternative pointed out in TDPL, clear(), is still under development, it seems.

I'm happy to have read here that it will not call the object constructor, which will not only reduce its impact on performance substantially, but also provide "cleared" objects with a recognizable state. This is much better than "resetting" them.

Someone else pointed out that the same behaviour (reverting all fields to .init state and flagging the object as cleared) could actually be assigned to the "delete" keyword. This too sounds like a good idea, because old D2 code could, at least partially, retroactively become memory safe. Not to mention the familiarity.

Regardless of the direction chosen for delete and clear(), Phobos is still lacking in functions that ease the management of the C heap.

Boost has an interesting memory pool mechanism for C++. I think that Phobos would benefit from such a library. Are there plans to implement an equivalent in D?


More information about the Digitalmars-d mailing list