uitable run in loop causes java out of memory and crashes

1 view (last 30 days)
I am generating figures in a loop, including plots and a uitable (30x13). Using MATLAB 2012b and a Win 7 64bit PC with 8GB RAM. I have added pauses before the uitable and that brought me up to 200 loops possible, but still crashes. Running more figures results in several lines of error (java & memory related). I cannot copy the errors, as the matlab usually hangs then and just closes...
Any ideas?
  1 Comment
John Anderson
John Anderson on 25 Nov 2013
I am having a similar problem. I am publishing a file that generates a large number of figures containing uitables although only displaying one at a time. I experience a java memory error (java.lang.OutOfMemoryError: Java heap space) and Matlab hangs or becomes sluggish. I have taken a look at the amount of free memory avilable between figures via a call to java.lang.Runtime.getRuntime.freeMemory and this tends to decrease over time, even though the figures are being deleted once their contents have been published. I guess this reflects an underlying memory management issue relating to uitable as this doesn't occur with other uicontrols. I'd be interested to hear any progress on resolving this issue.
John

Sign in to comment.

Answers (1)

Jan
Jan on 10 Sep 2013
Do you create 200 figures in a loop and leave them all open? If so, why? No human can navigate in a pile of 200 windows.
Increasing the Java Heap Space might be useful, but I assume it is much better to find a solution, which creates less figures, e.g. by re-using existing figures and uitables and updating the contents only.
  2 Comments
Daphne
Daphne on 10 Sep 2013
Sorry, I didn't mention that. No, I do not generate that many figures. I open a figure, get everything on it, save it as PDF, then close it (thought close may be better than just clf).
Jan
Jan on 10 Sep 2013
Re-using an existing figure saves a lot of resources, and after a lot of Java related problems, re-using the uitable might be even more important.

Sign in to comment.

Categories

Find more on Migrate GUIDE Apps in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!