This is more of a mental note to self. But it gives a small insight to what I'm battling with.
I've just traced in which way VMNetChannel allocates its ByteBuffer (ByteBuffers are used for pretty much anything handling data, not only network stuff, so its a pretty crucial thing to have).
Starting in VMNetChannel, we find a ByteBuffer.allocate(int capacity). It goes something like this:
DirectByteBufferImpl.ReadWrite(capacity)ReadWrite is an internal class which calls:
ReadWriteconstructor calling its super constructor:
DirectByteBufferImpl(cap)yep, ReadWrite extends DirectByteBufferImpl
DirectByteBufferImplconstructor calls its super (back to ByteBuffer) with a few arguments:
ByteBuffer(capacity, capacity, 0, -1, VMDirectByteBuffer.allocate(capacity), null, 0)which passes on to its super, Buffer
Buffer(capacity, capacity, 0, -1, VMDirectByteBuffer.allocate(capacity), null, 0)
VMDirectByteBuffer.allocate(capacity) is native call in javanio.library, and actually does something else than throwing itself back and forth.
VMDirectByteBuffer.allocate() returns a Pointer which will be stored in Buffer().