Reply to AxelS,

Hello everyone,
I've got a problem with the following (very simple) code:
void foo()
{
void[] dat=new void[50_000_000]; // allocate 50 MByte of
dummy-data
delete dat;
}
after I called foo() and watched the memory usage in the windows
taskmanager, the program blowed up to 50 MBytes although I deleted the
allocated memory...

Why can't the GC remove that data and how CAN I remove it?

Thanks in advance!


You can't. The D runtime (and most other runtimes) don't ever reduce the amount of memory they keep in the heap. If you where to allocate another 25MB right after that function you would see no change in the memory usage. The good news is that with virtual memory, all of that has almost zero cost. What matters is how much ram you are actively using.


Reply via email to