Memory management 跳转不释放内存

Memory management 跳转不释放内存,memory-management,garbage-collection,julia,julia-jump,Memory Management,Garbage Collection,Julia,Julia Jump,为什么在这种简单的情况下,垃圾收集器不能释放跳转分配的所有内存@时间也只有71M using JuMP, GLPKMathProgInterface function memuse() pid = parse(Int,readall(pipeline(`ps axc`,`awk "{if (\$5==\"julia\") print \$1}"`) )) return string(round(Int,parse(Int,readall(`ps -p $pid -o rss=`))/10

为什么在这种简单的情况下,垃圾收集器不能释放跳转分配的所有内存@时间也只有71M

using JuMP, GLPKMathProgInterface
function memuse()
  pid = parse(Int,readall(pipeline(`ps axc`,`awk "{if (\$5==\"julia\") print \$1}"`) ))
  return string(round(Int,parse(Int,readall(`ps -p $pid -o rss=`))/1024),"M")
end

function optimize()
  m = Model(solver=GLPKSolverLP())
  @variable(m, x[1:10] >= 0)
  @constraint(m, con[i = 1:10000000], x⋅rand(10) >=0)
  solve(m)
  return getobjectivevalue(m)
end

println("Before $(memuse())")
@time optimize()
println("Created $(memuse())")
gc()
println("After gc() $(memuse())")
输出


71M是分配的数量,它实际使用了3.6GB累计请链接如果您重复发布:71M是分配的数量,它实际使用了3.6GB累计请链接如果您重复发布:
Before 139M
 11.683382 seconds (71.59 M allocations: 3.635 GB, 44.04% gc time)
Created 1471M
After gc() 924M