I have a java code which basically creates, displays and then destroys geometry objects like spheres for a certain number of iterations. I use native opengl calls for displaying these objects. There is some memory leak in the code as the native memory keeps on increasing. I am checking the native memory by viewing the "Workink Set" memory in Task manager. However, when I ran the netbeans profiler, I couldn't find any memory leak. So, how to find the native memory leak? Are there any tools available to visualize both the native and heap memory usage?
Thanks!!
JConsole can help viewing Java memory usage.
If you are using an existing Java-OpenGL library, it is possible it is using direct buffers which might not be getting freed. If you have written the native code yourself this probably wont apply.
For native memory, if your Java-OpenGL library is using direct buffers, I've noticed in JDK 7 only (I'm running the prerelease) that there are some extra MBeans visible in JConsole that are not there in previous versions that may help. Take a look in the MBeans tab in JConsole under java.nio.BufferPool. Under the 'direct' bean you can see the memory used up by direct buffers. If this keeps going up, it might indicate a direct memory leak (possibly because of not closing/disposing OpenGL resources in your Java code).
java has free tool known as native memory tracker. You can baseline it and then generate a difference at regular intervals.
Using this difference you can easily identify which part of memory is leaking memory.