[llvm-commits] [PATCH] poison freed memory in DenseMap.h

Török Edwin edwintorok at gmail.com
Tue Jul 21 10:59:03 PDT 2009


On 2009-07-21 20:35, Daniel Dunbar wrote:
> Is there an easy way to do this more globally? 

I would love to have an easy way to do it globally.

Short of patching everything to poison memory before free I don't know
of another easy way.
I was hoping that providing a custom delete operator would work, but
that only takes the pointer as parameter,
and not the size :(

Another option would be to use our own memory manager, but that would
cause problems
such as valgrind not being able to trace allocations, and different
behavior versus release mode where system's MM is used.

> I would support
> enabling this globally in Debug (but not Release) mode, it increases
> determinism across platforms, frequently small memory errors only show
> up on one platform or another.
>
>   

Yes, this can be a useful debug tool, especially when running llvm-gcc
under valgrind is too slow to be bugpointable.

Best regards,
--Edwin



More information about the llvm-commits mailing list