casseopea2 / gperftools

Automatically exported from code.google.com/p/gperftools
BSD 3-Clause "New" or "Revised" License
1 stars 0 forks source link

Feature request: tcmalloc should support a debug mode that sanity checks allocations/deallocations #114

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago

This is a feature request. Tcmalloc should support a debug mode where it 
sanity checks the various allocations/deallocations. For instance, it could  
do one or more of the following in this mode:

1) Check that a pointer being freed is valid (e.g., guard against multiple 
frees of the same pointer).

2) Insert a guard zone at the beginning and end of an allocated memory 
region and ensure (during deallocation) that this guard zone was not 
overwritten by the user.

3) Check use of already freed memory. This can be done by writing a magic 
number in the freed block and then at a subsequent allocation checking that 
this magic number is not overwritten.

Original issue reported on code.google.com by mohit.a...@gmail.com on 22 Mar 2009 at 6:02

GoogleCodeExporter commented 9 years ago

Original comment by csilv...@gmail.com on 26 Mar 2009 at 2:14

GoogleCodeExporter commented 9 years ago
We now provide this!, as part of perftools 1.4.  It does all 3 things you asked 
for
and a bit more.  Play around with it and see what you think.

Original comment by csilv...@gmail.com on 11 Sep 2009 at 6:44

GoogleCodeExporter commented 9 years ago
Great - thanks.

Original comment by mohit.a...@gmail.com on 11 Sep 2009 at 6:49