Back to the main page.
Bug 1997 - Java out of memory error
Status | CLOSED FIXED |
Reported | 2013-02-19 20:01:00 +0100 |
Modified | 2013-04-23 12:06:30 +0200 |
Product: | FieldTrip |
Component: | qsub |
Version: | unspecified |
Hardware: | PC |
Operating System: | Linux |
Importance: | P3 normal |
Assigned to: | Robert Oostenveld |
URL: | |
Tags: | |
Depends on: | |
Blocks: | |
See also: |
Marcel Zwiers - 2013-02-19 20:01:29 +0100
It is not really a qsubcellfun bug but maybe a work-around can be created. The following out of memory error occurs when running a lengthy qsubcellfun job from the matlab-desktop: Error using ==> pause Java exception occurred: java.lang.OutOfMemoryError: Java heap space Error in ==> qsubcellfun at 381 pause(0.1); [...] Interestingly (and maybe something that can be mentioned in the qsubcellfun-help), this does not happen when the same qsubcellfun job is started from the bash terminal (e.g. when using Matlab's -nodesktop startup option).
Robert Oostenveld - 2013-02-20 08:41:25 +0100
I have no idea what causes this problem. The qsub functions don't explicitly use java and also work with nojvm. In absence of further clues on the cause, I don't see how it can be fixed. Perhaps it is a printing-to-desktop problem. The desktop is implemented with java, and qsub prints some progress information occasionally. I suggest you make a local copy of the qsub directory, and therein search and replace fprintf by %fprintf, i.e. disable all printing to screen in all functions. If that solves the java heap error and demonstrates that the issue is related to printing, I will implement a 'feedback' option that can be set to 'no'.
Marcel Zwiers - 2013-02-28 09:56:04 +0100
Now, I have been using R2010b, but it turns out that pause has a known memory leak in R2011b and R2012a (whenever pause is called, the graphics event queue (EDT) is flushed, thereby updating all Matlab figure windows) that is probably the same one I encountered: http://undocumentedmatlab.com/blog/pause-for-the-better/ The advice is to replace pause() with a direct call to the java Thread.sleep() function, e.g. implemented like this: function pauseJava(tPauseSec) th = java.lang.Thread.currentThread(); %Get current Thread th.sleep(1000*tPauseSec) %Pause thread, conversion to milliseconds
Marcel Zwiers - 2013-02-28 11:27:28 +0100
To account for -nojvm cases a usejava switch can be used: function pauseJava(tPauseSec) if usejava('jvm') th = java.lang.Thread.currentThread(); %Get current Thread th.sleep(1000*tPauseSec) %Pause thread, conversion to milliseconds else pause(tPauseSec) end
Robert Oostenveld - 2013-03-14 14:40:35 +0100
r7665 | roboos | 2013-03-14 14:37:25 +0100 (Thu, 14 Mar 2013) | 2 lines enhancement - use pausejava instead of pause to work around a MATLAB memory leak, see http://bugzilla.fcdonders.nl/show_bug.cgi?id=1997. Wait up to 60 seconds for the job input file to arrive, this might help for slow NFS systems. deze log message is trouwens niet helemaal correct, ik heb de functie pausejava genoemd, niet javapause.
Robert Oostenveld - 2013-04-23 12:05:55 +0200
closed various bugs