Is it a must to let Aggregation's Accumulator's memory allocation handled by HashStringAllocator? #8469
-
We are trying to implement a Aggregation function which need to use CRoaring(See [1]), from the existing aggregation function implementation, seems memory allocation of Accumulator should be handled by HashStringAllocator, e.g. But since we are using an external library, it seems hard to make CRoaring accept HashStringAllocator as memory allocator, is it a must? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 4 replies
-
I noticed there is a chapter in CRoaring README.md that says about this, https://github.com/RoaringBitmap/CRoaring/tree/master?tab=readme-ov-file#custom-memory-allocators, does it help? |
Beta Was this translation helpful? Give feedback.
It seems that a little hacking is needed. After all, the CRoaring library does not expose more interfaces.
The requirement here can be simplified to: when the hook it provides (such as the
my_malloc
callback function) is called, the correspondingMemoryPool
(may be an operator-pool) should be found and updated, right?I'm not an expert in CRoaring, but I can provide an implementation idea:
we can set the
MemoryPool*
(may be an operator-pool) object in thread-local before entering the CRoaring library, and then obtain the MemoryPool object of the current thread in the callback, and then callMemoryPool::allocateContinuous()
interface.Is this method feasible?