Hi All
Using DirectByteBufferAllocator could cause non-heap memory to be
allocated which the OS may find difficult to reclaim. On some JVMs this
could even lead to a OOM and/or crash (Seen on Debian esp with 32 bit
JDK). Using the Heap variant seems to be a solution, although it
increases the GC overhead.
I was also looking at the ExpandableBuffer.expand() method, and was not
able to understand why the size is increased as:
int newcapacity = (this.buffer.capacity() + 1) << 1; The default 8192
causes the buffer to become 16386.. what is the reason behind adding 1
here..
I am thinking of extending the ByteBufferAllocator interface so that one
could write an implementation that could cache and reuse buffers. e.g. a
pre-allocated number of direct buffers and/or some heap buffers may make
this much more optimal. Once a buffer becomes free, the same could be
handed back to the allocator, who could then cache or discard that. Will
this be a good idea to implement?
thanks
asankha
--
Asankha C. Perera
Founder and CTO, AdroitLogic, http://adroitlogic.org
VP Apache HttpComponents
http://esbmagic.blogspot.com
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]