On 02/27/2018 09:30 UTC, Marc MarĂ­ wrote:

In our memory allocator, memory chunks can be allocated in one pool and
freed in another (different) pool. This is no problem, because chunks
have a specific size, and they are pushed to a queue of free chunks.

Well, yes it is a problem ... because memcheck does not understand.
Such an implementation violates the property that a block belongs
to one specific and unchanging pool.

It is likely that the soonest-to-implement solution is for the custom
allocator to free() a block back into the same pool from which it was
allocated.  On a 32-bit architecture this should be easy: the entire
address space is only 1M pages of 4KB, and 1M of bits is only 128KB.
Give each pool such a bitmap which implements the characteristic function
"do I manage this page?"
For a 64-bit architecture, in practice a small handful of 4GiB regions
will cover all the pools.  So divide-and-conquer.

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Valgrind-users mailing list
Valgrind-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/valgrind-users

Reply via email to