File:  [DVB] / dietlibc / contrib / debug-realloc.txt
Revision 1.1: download - view: text, annotated - select for diffs
Tue Apr 23 22:02:27 2002 UTC (22 years, 1 month ago) by fefe
Branches: MAIN
CVS tags: finnland_test_200301, branch_rc14_fieldtest_finnland, branch_rc13_fieldtest_finnland, branch_rc12_fieldtest_finnland, branch_rc10_fieldtest_finnland, RELEASE_finnland_200301_1, RC12_FIELDTEST_FINNLAND, RC10_FIELDTEST_FINNLAND, HEAD
add stupid malloc debugging helper

This is a stupid malloc debugger.

malloc will always round up to a full page and then mmap one more page
than that.  It will then allocate the space in a way that makes the
allocation end at one page, thus causing access behind the array border
to segfault.

realloc will malloc new memory, copy the old contents, and then mprotect
the old memory away, so referencing it will cause a segfault, too.

This is a big drain on resources and will slow down your program.  But
it may prove useful in finding bad memory references in your code.

LinuxTV legacy CVS <linuxtv.org/cvs>