JuliaPy / JuliaPy/PyPlot.jl

PyPlot memory deallocation problem

未关闭
#111 21 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
Julia
星标
488
派生
90
PR 合并指标
30 天内没有已合并 PR

描述

Hi,

when batch saving multiple figures with 'savefig()' a large amount of memory is
allocated and I am not able to free it afterwards without closing my julia session.

Basically I am doing:

``` julia
for ff=101:150
figure(1)
PyPlot.clf()
imshow(imagg,extent=[0,350,0,580],aspect=1);
imshow(gridG[1:18,1:35,ff],interpolation="bicubic",cmap="jet",origin="lower",extent=[14,339,158,300],alpha=.5,aspect=.8)
PyPlot.autoscale("off")
plt.axis("off")
plt.title("Absolute value @" *string(ff)* " Hz")
savefig("~/pianoMeas1/klavierKlopfTest_"*string(ff)*".png");
plt.close()
end
```

The memory usage before the loop is ~2gb, after the loop it is ~4gb.

I also tried

``` julia
figurN=open("~/pianoMeas1/klavierKlopfTest_"*string(ff)*".png","w")
plt.savefig(figurN);
close(figurN)
```

giving the same result.

When overwriting existing files the memory usage stays constant so I believe the
"memory-overflow" occurs while allocating space for the file, but this is just a shot in the dark.

My julia version is:

``` julia
versioninfo()
Julia Version 0.4.0-dev+2496
Commit 89f89e1* (2015-01-05 09:04 UTC)
DEBUG build
Platform Info:
System: Linux (x86_64-unknown-linux-gnu)
CPU: Intel(R) Core(TM) i7-2600K CPU @ 3.40GHz
WORD_SIZE: 64
BLAS: libopenblas (USE64BITINT DYNAMIC_ARCH NO_AFFINITY Sandybridge)
LAPACK: libopenblas
LIBM: libopenlibm
LLVM: libLLVM-3.3
```

Any ideas, pointers are appreciated as I am not shure where to start debugging this.

贡献指南

这个仓库没有索引到贡献指南

调研方向

Reproduce the reported loop using PyPlot.savefig, plt.close, and the Julia versioninfo shown in the issue, comparing new output files with overwritten files. Trace the savefig and close entry points across the Julia/Python boundary and measure memory after each iteration; done means repeated saves no longer leave the additional allocation behind.

由索引模型根据 Issue 内容生成。

评估

技术栈
julia, python
领域
data-visualization
Issue 类型
缺陷
难度
4/5
预计耗时
3-5 天
活跃度
停滞
描述清晰度
基本清楚
新手友好度
35/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。