MATLAB: Subs Function Memory Leak

leakMATLABmemorymemory leaksubssubs function

Hi, I'm running a function (for discussion purposes I'll call it myfun.m) which utilizes both "solve()" and "subs()" function. Multiple runs of the myfun causes longer and longer execution times. I believe this issue is some sort of memory leak. If I close out of Matlab, open it back up, and execute myfun, it runs at the normal speed. If I continue executing it over and over it then begins to slow down. I was running 2007, but I'm upgrading to 2010. Has this problem been fixed? Is there some sort of clear function I can use that preserves my variables but clears whatever objects are being generated by subs or solve?

Best Answer

solve() uses mupad which has its own memory area. Try using
reset(symengine)