2018-03-23 21:18 CET

View Issue Details Jump to Notes ]
IDProjectCategoryView StatusLast Update
0001475Orfeo Toolbox (OTB)Generalpublic2018-01-29 13:54
Assigned To 
PlatformunixOSRH7OS Version
Summary0001475: python otbApplication memory usage
DescriptionI have notice that the python otbApplication(s) objects used a lot of ram memory even after the end of the method executeAndWriteOutput(). I was expecting that the allocated ram required for the processing was released after the end of the actual processing.

To summuraize, the application allocate the ram only at the begining of executeAndWriteOutput() and is not release at the end.
Is it a nominal behavior?

I provide below a short code sample to reproduce this behavior.
Steps To ReproducebandMathApp = otb.Registry.CreateApplication("BandMath")
bandMathApp.SetParameterString("exp", "(im1b1==100)?1:0")
bandMathApp.AddParameterStringList("il", "in.tif")
bandMathApp.SetParameterString("out", "out.tif")

bandMathApp.SetParameterString("ram", str(1024))

def memory_usage_psutil():
    # return the memory usage in MB
    import resource
    print 'Memory usage: %s (MB)' % (resource.getrusage(resource.RUSAGE_SELF).ru_maxrss / 1000.0)
TagsNo tags attached.
Attached Files




julien (administrator)

This is a known issue (see https://wiki.orfeo-toolbox.org/index.php/Wishlist , applications section)

I think that you can workaround the problem by doing bandMathApp = None at the end.

But there is definitively something to fix on the ApplicationEngine side.


gpasero (administrator)

Last edited: 2018-01-26 18:57

View 2 revisions

I have made a few observations:
* Doing "bandMathApp=None" at the end doesn't free the memory
* The memory usage is affected by the RAM parameter, for instance:
  * RAM=128 -> Memory usage = 625 (MB)
  * RAM=512 -> Memory usage = 1032 (MB)
* Calling ExecuteAndWriteOutput() several times causes an additional memory usage (around 10 MB in my case).

So, yes, there is definitely something going on here.


gpasero (administrator)

Probably several features are missing :
* in the C++ API : clean all the buffers in the application pipeline ( ReleaseData ? )
* estimate bias and gain to fix memory footprint estimation

To be investigated for 6.6

-Issue History
Date Modified Username Field Change
2017-10-26 15:18 salguesg New Issue
2017-10-26 15:20 julien Note Added: 0004426
2018-01-26 18:52 gpasero Note Added: 0004533
2018-01-26 18:57 gpasero Note Edited: 0004533 View Revisions
2018-01-29 13:54 gpasero Note Added: 0004534
+Issue History