I’ve written a 3D app with JOGL that is called from MATLAB and makes use of display lists. I’ve noticed that when I run the app outside of matlab, it will render at full speed and terminate properly.
When I run the app from matlab, it will run at full speed the first five or six times it is called. After that, its framerate will plummet. I have a hypothesis about what is going on:
MATLAB does not terminate the JVM when it returns from a function. You can’t call System.exit(), or MATLAB itself will quit, so the VM apparently MUST stay running in the background. My guess is that the graphics memory associated with my display lists is not being fully released, so that each time I call the program, more and more gets taken up, until there is none left and the contents of the list have to be sent from main memory. BUT, I am calling glDeleteLists() for every list I can keep track of. How do I release those resources? Is this a bug, or something emergent from the fact that MATLAB doesn’t execute java programs the way one would expect? Or is there some simple call I can/should make?