|
From: Jason E. <ja...@ca...> - 2005-05-06 17:04:42
|
On Fri, May 06, 2005 at 10:26:35AM -0500, Nicholas Nethercote wrote:
>
> One downside of such allocations is that if your allocator doesn't have
> any redzones or metadata between blocks, you can't detect an overrun from
> one block into another, because it's all considered addressable by
> Memcheck.
Ahh, good point. I do have optional red zones embedded in the separators
that delimit user-allocated regions:
RRRR....RRRR
---------
RRRR....RRRR
----------
RRRR....RRRR
However, I was making the mistake of both telling valgrind that the
allocations (-----) have red zones (RRRR), and that the red zones are
allocated as part of the separators (RRRR....RRRR).
I've fixed my code to never tell valgrind that the red zones are allocated,
and it longer trips on the assertions, as long as red zones are enabled.
However, if red zones are disabled, my code still trips on both assertions
that the original patch addressed. In that case, memory looks like:
....
--------
....
------------
....
And valgrind has been told that the user allocations (----) and the
separators (....) are allocated. None of the allocations overlap, and I'm
no longer making the mistake of telling valgrind that red zones are
allocated.
So, as near as I can tell, the patch is still relevant, though my code no
longer trips on the bad assertions.
Thanks,
Jason
|