When using the offheap cache (3.8.1) under stress i'm seeing an excessive amount of garbage being created.
From what i can tell the org.ehcache.impl.internal.store.offheap.portability.OffHeapValueHolderPortability#encode method, called on every put request, is allocating a temporary heap bytebuffer in order to append header meta data before being persisted to the offheap memory.
This is not a problem when the size of my data remains small however as it grows the heap is being put under considerable pressure.
If a may i would like to propose changing the code to avoid this intermediate bytebuffer allocation.
Remove the allocation in the encode method and pass the OffHeapValueHolder, together with the keyBuffer and valueBuffer, to an overloaded writeMappingBuffers in the OffHeapBufferStorageEngine class.
What do people think? A workable suggestion?