Am 03.03.2015 um 13:29 schrieb Christian Ducrée:

I'm trying to free the memory after a large JSON object was created:

void createobject(){

 Json jso = Json.emptyObject();
 for(int i=0;i<1000000;i++){
    string str = format("Attrib #%d", i);
    jso[str] ="012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789";

 }

}

I tried:

GC.collect();

and

destroy(jso);

to no avail.

destroy(jso); followed by GC.collect() should free the memory within
the GC pools. However, the GC just recycles the memory for later
allocations and doesn't give it back to the OS. At least that used to be
that case.

You could call createobject() within a loop to verify that the memory
really gets recycled, or if there is a genuine memory leak.