Deallocate array?

Matic Kukovec matic.kukovec at pametnidom.si
Tue May 7 16:09:28 PDT 2013


Hi

I'm running Windows Vista 64 with dmd 2.062.

I have a simple program:

import std.stdio, core.memory, std.cstream;
void main()
{
	string[] temp_array;

	for(int i=0;i<5000000;i++)
	{
		++temp_array.length;
		temp_array[temp_array.length - 1] = "aaaaaaaaaaaaaaaaaaaaa";
	}
	
	temp_array = null;

	GC.collect();
         writeln("end");	
	din.getc();
}

When the program waits at "din.getc();", memory usage in the Task 
Manager is 150MB.

Why isn't the memory deallocating?

P.S.;
I tried temp_array.clear() and destroy(temp_array), but nothing 
changed.


More information about the Digitalmars-d-learn mailing list