diff --git a/common/thorhelper/roxierow.cpp b/common/thorhelper/roxierow.cpp index 48d297361be..ea4d7706e42 100644 --- a/common/thorhelper/roxierow.cpp +++ b/common/thorhelper/roxierow.cpp @@ -488,9 +488,12 @@ class CAllocatorCache : public CSimpleInterfaceOf CAllocatorCacheItem *container = _lookup(meta, activityId, flags); if (container) { - if (0 == (roxiemem::RHFunique & flags)) + if (0 == ((roxiemem::RHFunique|roxiemem::RHFblocked) & flags)) return LINK(&container->queryElement()); - // if in cache but unique, reuse allocatorId + // If in cache but unique, reuse allocatorId, but create a unique allocator (and heap) + // If blocked the allocator must not be commoned up! (The underlying heap will be within roxiemem.) + // This is very unusual, but can happen if a library is used more than once within the same query + // since you will have multiple activity instances with the same activityId. SpinUnblock b(allAllocatorsLock); return callback->createAllocator(this, meta, activityId, container->queryAllocatorId(), flags); }