Honesty Rocks! truth rules.

Java Memory Leak?

HOME      >>       Programming


 I have been using the picking tool with setShapeCylinderSegment (this returns infinit results but is capped). It works just fine for me (in terms of what it does) and it wasn't until just recently I noticed that it has been causing my program to spike the memory. I have looked through Google to see the problem and apparently it is caused a memory leak. I have tried to solve it by simply setting all the variables to null after they are used but this doesn't help. Is there something I can do to or a free software I can use to find the exact variable that is causing this problem and a way to fix it. Here is the exception I received:

Exception in thread "AWT-EventQueue-0" java.lang.OutOfMemoryError: Java heap space  at com.sun.j3d.utils.picking.PickResult.intersect(Unknown Source)  at com.sun.j3d.utils.picking.PickResult.generateIntersections(Unknown Source)  at com.sun.j3d.utils.picking.PickResult.numIntersections(Unknown Source)  at com.sun.j3d.utils.picking.PickTool.pickGeomAllSortedIntersect(Unknown Source)  at com.sun.j3d.utils.picking.PickTool.pickGeomClosestIntersect(Unknown Source)  at com.sun.j3d.utils.picking.PickTool.pickClosest(Unknown Source)  at KeyNavigatorApp.getLandHeight(KeyNavigatorApp.java:613)  at KeyNavigatorApp.UpdateKeyPressed(KeyNavigatorApp.java:1243)  at KeyNavigatorApp$6.actionPerformed(KeyNavigatorApp.java:1117)  at javax.swing.Timer.fireActionPerformed(Timer.java:271)  at javax.swing.Timer$DoPostEvent.run(Timer.java:201)  at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)  at java.awt.EventQueue.dispatchEvent(EventQueue.java:597)  at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:273)  at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:183)  at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:173)  at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:168)  at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:160)  at java.awt.EventDispatchThread.run(EventDispatchThread.java:121)
Thanks in advanced,


Maybe you don't have a memory leak but a memory peak. Try starting the JVM with more memory by using -Xmx parameter at the startup. This way you might be able to avoid the "out of memory" error.


How much memory is your system running on?xboxrulz