Hi, I've changed over to using the latest milestone release, 2.0.0-M1 and I have a question about IoBuffer.autoExpand(true). I'm basically doing the following:
IoBuffer buf = IoBuffer.allocate(1024); buf.setAutoExpand(true); [various buf.putXXX calls] buf.flip(); [write buffer] I note that the documentation for autoExpand(true) says this: "The underlying ByteBuffer is reallocated by IoBuffer behind the scene if the encoded data is larger than 16 bytes in the example above. Its capacity will double, and its limit will increase to the last position the string is written." For most of my usage, a small buffer is all I need. However, there are specific instances where that IoBuffer will need to grow to 1MB+. The problem I'm having is that when it needs to grow, it appears to be growing very slowly, contrary to what the documentation says. For instance, I printed out IoBuffer.capacity() at various points and see this: Capacity: 892736 Capacity: 892958 Capacity: 893070 Capacity: 893292 Capacity: 893410 Capacity: 893632 Which tells me that it's growing very slowly which jibes with how I'm seeing the machine behave (using 100% CPU for a few minutes). Not only that, but we had the same problem with our own buffers (coincidentally named IoBuffer about 10 years ago, feels like I'm right at home :-P ) and we implemented basically the algorithm you have (double the capacity), but we also allowed the user to specify how to grow the buffer (a simple "growSize" parameter). The point of this latter comment is that we had the same behavior I'm seeing with MINA's IoBuffers before we fixed our growth algorithms. I haven't gotten down into the MINA code yet, I just wanted to see if anyone had any obvious comments on what I might be doing wrong. BTW, thanks for MINA, I was going to write something equivalent to it for our own products, but I was very, very happy to see someone else doing it and saving me quite a bit of time ;-) Cheers, Craig