4 messages in net.java.dev.jna.usersRe: [jna-users] Catching critical mem...
FromSent OnAttachments
Stas OskinSep 19, 2008 10:14 am 
Timothy WallSep 19, 2008 10:38 am 
Stas OskinSep 19, 2008 11:51 am 
Stas OskinSep 20, 2008 3:29 am 
Actions with this message:
Paste this link in email or IM:
Paste this link in email or IM:
Atom feed for this thread
Paste this URL into your reader:
Subject:Re: [jna-users] Catching critical memory leak in JNA/nativeActions...
From:Timothy Wall (twal@dev.java.net)
Date:Sep 19, 2008 10:38:48 am
List:net.java.dev.jna.users

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.