Memory leak
otbApplication (no leak)
import psutil
import otbApplication as otb
p = psutil.Process()
def process(n=10):
for i in range(n):
print(f"RAM: {p.memory_info().rss / 1024 / 1024:.2f} mb")
bm = otb.Registry.CreateApplication("BandMathX")
bm.SetParameterStringList("il", ["/data/France_Selfy_Montpellier_MTD_20240910_hd.jpg"])
bm.SetParameterString("exp", "im1")
bm.Execute()
si = otb.Registry.CreateApplication("Superimpose")
si.SetParameterInputImage("inr", bm.GetParameterOutputImage("out"))
si.SetParameterInputImage("inm", bm.GetParameterOutputImage("out"))
si.SetParameterString("out", "/data/todel/image.tif")
si.ExecuteAndWriteOutput()
process()
pyotb (leak)
import psutil
import pyotb
p = psutil.Process()
def process(n=10):
for i in range(n):
print(f"RAM: {p.memory_info().rss / 1024 / 1024:.2f} mb")
bm = pyotb.BandMathX(il="/data/France_Selfy_Montpellier_MTD_20240910_hd.jpg", exp="im1")
si = pyotb.Superimpose(inr=bm, inm=bm)
si.write("/data/todel/image.tif")
process()
Comparison
run# | otbApplication | pyotb |
---|---|---|
1 | 65.25 | 249.15 |
2 | 1092.00 | 2200.69 |
3 | 1204.98 | 2376.72 |
4 | 1204.79 | 2538.09 |
5 | 1204.94 | 2713.59 |
6 | 1204.34 | 2875.89 |
7 | ... | 3051.51 |
8 | ... | 3213.76 |
9 | ... | 3388.59 |
pyotb versions
Version | Bug |
---|---|
2.0.1 | yes |
1.5.3 | yes |
1.4.1 | yes |
1.4.0 | no |
1.3.3 | no |
1.3.1 | no |
1.3.0 | no |
A priori the bug occurs btw 1.4.0 and 1.4.1
Edited by Cresson Remi