delete a dynamic array

Chris R. Miller lordsauronthegreat at gmail.com
Sat Oct 11 18:42:45 PDT 2008


tsalm wrote:
> Hello,
> 
> It's certainly a stupid question...
> 
> I want to delete an dynamic array of the memory.
> I don't understand why the example above doesn't clear the memory uses 
> by the array :
> 
> /* ------------------------------- */
> import tango.time.Time;
> import tango.io.Stdout;
> import tango.stdc.stdio;
> import tango.core.Memory;
> 
> void main()
> {
>  // Create a big array
>  int[] t = new int[100000000];
> 
>  // delete the array
>  t = null;
> 
>  // Clean the memory
>  GC.collect();
>  GC.minimize();
> 
>  // No, it's not free :-(
>  Stdout("Now, the memory must be free...")();getchar;
> }
> 
> /* ------------------------------- */
> 
> How can I totally clear this array of the memory ?
> 
> Thanks in advance,
> TSalm

delete t;


More information about the Digitalmars-d-learn mailing list