Hi. Can you help me please?
I asked also to "General Group" but i haven't solved my problem.
I have tried many experiments but without success.
I have a dynamic array of strings:
string[] vec;

After to have inserted dynamically 5_000_000 strings to array, for six times, i measure the RAM with an utility (for example Wise Memory Optimizer), deleting the array every time.

Every time I destroy the array, but the RAM is always less.
In particular:

- at beginning the FREE RAM is 1564 MB;
- after first loop the FREE RAM IS 1480 MB
- after second loop the FREE RAM IS 1415 MB
- after third loop the FREE RAM IS 1402 MB
- after forth loop the FREE RAM IS 1338 MB
- after fifth loop the FREE RAM IS 1280 MB
- after sixth loop the FREE RAM IS 1200 MB
- at end the FREE RAM returns to 1564 MB

I want to reuse the dynamic array.

This is the program:

import std.stdio;
string[] vec;
void main()
{
    alloca();
    alloca();
    alloca();
    alloca();
    alloca();
    alloca();
}

void alloca()
{
    vec.destroy;
    writeln("Filling .....");
    for (int i = 0; i < 5000000; i++)
        vec ~= "1234567890ABCDEFGHIL123456";
    writeln("Array occupation: ", vec.capacity);
    writeln("Press <ENTER>");
    readln();
}

P.S.
I have tried: free(), destroy(), minimize(), GC, collect(), etc but without success.

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

Reply via email to