Description
Currently CqServerImpl.processEntryEvent copies each off-heap value it adds to cqUnfilteredEventsSet_newValue to the heap in this code:
if (cqUnfilteredEventsSet_newValue.isEmpty() && (event.getOperation().isCreate() || event.getOperation().isUpdate())) {
Object newValue = entryEvent.getNewValue(); // TODO OFFHEAP: optimize by not copying the value on to the heap
if (newValue != null)
}
The cqUnfilteredEventsSet_newValue does not live past this method call. The values in it are later passed to evaluateQuery.
It would be nice if we didn't need to copy the values to the heap in this code. It would be easy enough to retain them and then release everything in cqUnfilteredEventsSet_newValue in a finally block. But can evaluateQuery handle an offheap reference? If so then this would be a nice optimization for cqs on offheap regions.