It looks like:
1. You're not null-terminating the bytes from s.getBytes()
2. You're not retaining references to the ByteBuffers allocated via BufferUtils.createByteBuffer(s.length()), and so the GC might reclaim them and free the associated native memory.