We are looking to minimize (if not eliminate) object allocations in some high performance code. This was/is largely possible in previous versions of Chronicle Map (version 2.x). With the latest version of Chronicle Map (3.17.1) we seeing significant allocations when using ExternalMapQueryContext. We are following the tutorial here: https://github.com/OpenHFT/Chronicle-Map/blob/master/docs/CM_Tutorial.adoc
Is this expected? Are we using the proper approach?
VOInterface voi = VO.get();
try (ExternalMapQueryContext < CharSequence, voi, ? > ctx = map.queryContext(key)) {
if (ctx.readLock().tryLock()) {
MapEntry < CharSequence, voi > entry = ctx.entry();
if (entry != null) {
// Entry is present, return
entry.value().getUsing(voi);
accessor.accessData(voi);
// Key is absent
// Need to unlock, to lock to update lock later. Direct upgrade is forbidden.
ctx.readLock().unlock();
return true;
} else {
accessor.notFound();
// Key is absent
// Need to unlock, to lock to update lock later. Direct upgrade is forbidden.
ctx.readLock().unlock();
return false;
}
}
ctx.updateLock().lock();
MapEntry < CharSequence, voi > entry = ctx.entry();
if (entry != null) {
entry.value().getUsing(voi);
accessor.accessData(voi);
return true;
} else {
accessor.notFound();
return false;
}
}
We have screen grabs of the allocation stacks we can share as well.