Greg Stark <stark@mit.edu> writes:
> I wonder if we could go further. If we don't imagine having a very
> large number of allocators then we could just ask each one in turn if
> this block is one of theirs and which context it came from. That would
> allow an allocator that just allocated everything in a contiguous
> block to recognize pointers and return the memory context just by the
> range the pointer lies in.
The performance problem is not "large number of allocators", it's "large
number of distinct memory ranges". Also, this will fail utterly to
recognize duplicate-pfree and bad-pointer cases. Not that the existing
method is bulletproof, but this way has zero robustness against caller
bugs.
regards, tom lane