> I have
> absolutely no idea why the JVM's virtual memory keeps increasing! My
> java program uses lots of DirectByteBuffers which wrap huge shared
> memory areas. Do you think it could cause some trouble?
My guess is probably not. Not unless the size of the leak is comparable with
the size of your DirectByteBuffers themselves (which, since they are large and
you use lots of them, you would presumably have noticed earlier when your
program almost instantly ran out of memory ;-)
IIRC, DDBs do have a way of, not so much "leaking", as mis-managing memory.
The memory they use is reclaimed by garbage collection, but the GC is not
sensitive to the memory area that the underlying buffer is allocated from -- it
is only aware of the DDB object itself (a small wrapper object). As long as it
is happy that it has enough "normal" (heap) memory, it may not be too bothered
about cleaning up the DDB objects. But it doesn't know that the DDB objects
represent an expensive (big, and not inexhaustible) OS-level resource. So you
can end up either using more of the OS-level resource than you should, or even
running out entirely (which, confusingly, provokes an ordinary out-of-memory
exception) while the GC is still happy that there's plenty of memory available.
I can only suggest that you spend some time with one of the memory profiling
tools (I can't recommend any specific one).
> Are there any
> known bugs in JDK 1.5.0_06-b05 related to memory leak in JNI or
> something...
I don't know of any myself, but I don't follow the bug-lists so I could easily
have missed something.
-- chris