directory-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Trustin Lee <>
Subject Re: [mina] ByteBuffer allocation memory leak
Date Thu, 14 Jul 2005 13:32:30 GMT
Hi Donovan,

2005/7/14, Donovan Du Plessis <>:
> e.g. ByteBuffer buffer_ = ByteBuffer.allocate(lengthOfPacket);

Do you call ByteBuffer.wrap() to wrap existing NIO buffer or byte array? If 
so, it can cause memory leak. (Please see MINA ByteBuffer JavaDoc. You'll 
have to call buffer_.acquire() once to prevent the leak.)

If not, all newly allocated ByteBuffers are released to internal MINA 
ByteBufferPool. But it is not actually released, but hold by the pool 
forever. So in the short term, it can be look like a memory leak, but the 
usage of memory will not increase after sufficient amount of buffers are 
pooled by the MINA. If OutOfMemoryError occurs, please try to increase 
direct memory size of your VM like this:

java -XX:MaxDirectMemorySize=262144K ...

Please let me know the memory usage increases without limit even after 
following the instruction above. And it would be nice if which type of 
object is leaking.

what we call human nature is actually human habit

View raw message