java - How to Reduce Physical memory increase in Matlab? -
when running following code in matlab, physical memory usage of matlab increases until reaches 90% of system memory, , crashes program. code part of larger optimization scheme have many more iterations, has been simplified here.
import org.parent.modeling.* = 1:100 rtool = tool('c:/etc'); model = rtool.getmodel(); model.initsystem(); rtool.setmodel(model); rtool.run(); end
rtool
, model stored java objects in workspace. selectively removing steps bottom top, i've determined rtool.run()
; step causing incremental memory increase during each iteration. i've tried using variety of memory clearing techniques no success
clear classes, clear java, clear rtool model, clear
i have checked fragmentation running memory
command, insignificant. below actual code corresponds api documentation (https://simtk.org/api_docs/opensim/api_docs/classopensim_1_1rratool.html)
for = 1:1:4 import org.opensim.modeling.* rratool = rratool('c:\...filename.xml'); model = rratool.getmodel(); model.initsystem(); rratool.setmodel(model); rratool.run(); end
any suggestions reducing physical memory increase?
matlab: 2013
it difficult figure out doing here, let alone why leaking memory. have been able deduce, can call java matlab, , can call c++ directly matlab. cannot figure out if calling c++ library directly, or calling via java (jni / jna) wrapper. , if doing latter ... why.
for matlab -> c++ case, page has tips on avoiding memory leaks: http://www.mathworks.com.au/help/matlab/matlab_external/memory-management-issues.html
for matlab -> java -> c++ case, leaks due bugs in java wrapper or associated c++-side wrapper code, or problem in way using wrapper. instance, there dispose
method need call. details should in java api docs ... have not been able locate ... or in java source code itself.
i hoping there general memory clearing java commands use.
there no such magic commands. need figure out memory leaking , fix that.
Comments
Post a Comment