Most memory leak checkers should be capable of instrumenting a shared
library as well as an application, you just have to be more explicit
about init/shutdown.
One place JNA usage is likely to introduce a leak is if you return a
String or other allocated object from native code and neglect to free
it.
On Sep 19, 2008, at 1:15 PM, Stas Oskin wrote:
Hi.
I have a critical memory leak, that slowly fills the whole 6GB (2GB
RAM + 4GB swap) memory, crashing Java process, or even the server
itself. I inspected periodic java dumps with MAT (http://www.eclipse.org/mat/
) and have seen that the app itself allocates only about 40 MB,
which makes me to think that the issue somewhere in JNA or native
memory (as I indeed store a lot of information via native libraries
in memory).
My question is, how it's possible to catch this leak? Standard tools
like Valkyrie doesn't seem to work with Java, and, as said, Java
tools themselves see only the Java heap.
Is there any tools that can work both with Java/native code?
Also, I found via searching "JNA memory" leaks my previous thread
(http://markmail.org/message/vyjf6gi2smstztj6#query
:jna%20memory%20leaks+page:1+mid:4kvob3f234op5yrj+state:results
), and would like to mention that the problem there was indeed in
Java (rather then JNA/native code). Here is completely different
situation, where my Java app heap seems stays the same (a very
insignificant increase of allocated object), while the used memory
is rapidly growing.
Thanks in advance for any information.