How to deal with "Java Heap Space Outofmemroyerror" seems to be a commonly asked question. I am using Matlab R2011a, and one solution is to increase the java Heap Size, which can be done at: File -> Preferences -> General -> Java Heap Memory.
My wondering is, is there any command like "clear STH " that can clear the Java Heap Space Memory, just like "clear all" clears the whole matlab workspace, so Java Heap Memory can always be freed when needed.
I thought "clear java" will do the trick. But it turns out "clear java" functions almost the same as "clear all", exept that it also clears all java classes... What i am looking for is something that will only clear memory of Java heap and preserve all other variables.
Anybody here knows how to do this trick?