== Quote from Andrei Alexandrescu (seewebsiteforem...@erdani.org)'s > Any statistics about the amount of slack memory due to false pointers > would be appreciated. > Andrei
This is a corner case, but run the following code: import std.stdio, core.memory; void main() { foreach(count; 1..uint.max) { test; GC.collect; // Make it explicit to make absolutely sure GC is running. writeln(count); } } // Marked as pure to emphasize that it's not escaping someArray to anywhere, // so when test() goes out of scope, someArray is safe to GC. void test() pure { auto someArray = new uint[15_000_000]; } Disclaimer: My understanding is that this may work differently on Linux, but if you run it on Win32, it runs out of memory after about 20 iterations. I don't know about the average, but the worst cases are occasionally bad enough to make me eventually run out of 32-bit address space on stuff that should only be using ~150 megs of RAM, unless I manually delete a few large data structures. Associative arrays seem to be the worst problem because: 1. They generate a lot of false pointers. 2. They can often be large. 3. If even a few nodes don't get freed properly, they can fragment the heap severely.