Thread overview
How to destroy a big Array and free RAM
Dec 12, 2018
Giovanni Di Maria
Dec 12, 2018
NX
Dec 12, 2018
Giovanni Di Maria
December 12, 2018
How to delete an array and to free RAM

Hi. Can you help me please?
I have tried many experiments but without success.
I have a big array of arrays (matrix[][]).

After to have filled of data i measure the RAM with an utility (for example Wise Memory Optimizer).

Then i try to destroy the array in many modes, but the free RAM is still the same.

Can you help me please?
Thank you very much
Giovanni Di Maria

December 12, 2018
On Wednesday, 12 December 2018 at 08:14:57 UTC, Giovanni Di Maria wrote:
> How to delete an array and to free RAM
>
> After to have filled of data i measure the RAM with an utility (for example Wise Memory Optimizer).
>
> Then i try to destroy the array in many modes, but the free RAM is still the same.

Destroying and free-ing are not the same thing. Since D is a garbage collected language you probably want to do something like this:

import std.stdio;
import core.memory;

void main()
{
    long[][] array = new long[][](1024, 1024);
    writeln(GC.stats);
    destroy(array);
    GC.collect();	// Mark & Sweep
    GC.minimize();	// Free unused memory
    writeln(GC.stats);
}
December 12, 2018
On Wednesday, 12 December 2018 at 08:29:45 UTC, NX wrote:
> On Wednesday, 12 December 2018 at 08:14:57 UTC, Giovanni Di Maria wrote:
>> How to delete an array and to free RAM
>>
>> After to have filled of data i measure the RAM with an utility (for example Wise Memory Optimizer).
>>
>> Then i try to destroy the array in many modes, but the free RAM is still the same.
>
> Destroying and free-ing are not the same thing. Since D is a garbage collected language you probably want to do something like this:
>
> import std.stdio;
> import core.memory;
>
> void main()
> {
>     long[][] array = new long[][](1024, 1024);
>     writeln(GC.stats);
>     destroy(array);
>     GC.collect();	// Mark & Sweep
>     GC.minimize();	// Free unused memory
>     writeln(GC.stats);
> }



Hi NX
Thank you very very much.
Giovanni