Apparent problem with GC not collecting on Windows
    thedeemon 
    dlang at thedeemon.com
       
    Wed Nov 28 23:40:26 PST 2012
    
    
  
On Wednesday, 28 November 2012 at 22:02:35 UTC, Michael wrote:
> Only 3 iterations before out of memory exception?
Because you used uint instead of ubyte, array is bigger, memory 
exhausts faster.
> 3. Why it helps?
> GC.free(data.ptr);
Initial leak happened because for some reason array allocated in 
previous iteration was not collected by GC when allocating new 
one, so the new one was allocated in another space growing the 
heap. If you place GC.free the array gets removed from heap on 
each iteration and each new allocation reuses the same memory, 
heap doesn't grow.
    
    
More information about the Digitalmars-d-learn
mailing list