I asked this question on Julia-Opt, and Joey Huchette suggested I move it 
here.

https://groups.google.com/d/msg/julia-opt/i6wV8aeSLjg/pZHkEdhDjvsJ

The thrust of the question is that I'm deleting and garbage collecting 
dictionary values, but the memory associated with those values is not freed 
up after garbage collection. Joey pointed out that the dictionary could 
still be keeping a reference to the deleted object.

My example:
# System memory 500/15039MB

julia> d = buidModel();
"success"

# System memory at 8883/15039MB

# delete the model object - corresponds to about a 1 Gb LP file
# I observe the same effect if I enter
# julia> d["m"] = 0;

julia> delete!(d, “m”);

# System memory unchanged

julia> gc()

# System memory unchanged

# delete a list of affine expressions used to make constraints in the model 
- estimated 1GB - 2GB RAM
julia> d[“aff_exprs”] = 0

# System memory unchanged

julia> gc()

# System memory unchanged

julia> d = 0

# System memory unchanged

julia> gc()

# System memory 8255/15039MB

Why is memory not getting freed up when I delete or reassign dictionary 
values?

I can see how that by removing dictionary values with delete! references to 
deleted values might linger, but when I reassign and garbage collect it 
seems to me that they should be removed for good.

I'm using Ubuntu 14.04.1 LTS with Julia 0.3.8. I also observe this 
behaviour on Windows 7 with Julia 0.3.10.


Reply via email to