[LCP]Segmentation Faults when calling free()
Vincent Penquerc'h
Vincent.Penquerch at artworks.co.uk
Thu Feb 20 18:12:01 UTC 2003
> Solution? Compile with electric fence, and run in a debugger. Efence
> causes a segfault on the first instruction which writes
> outside the n bytes
> which you've been specifically allocated (and hence catches overruns,
> underruns, and fencepost errors). Very, very useful for
> finding bugs like
> this.
Just be aware that since efence aligns the memory to change page
where the allocated space ends, you'll have to do at least two runs,
once to detect overruns, and another to detect underruns (as in each
it will align differently, either the end of a block on the end of
a page, or the beginning of a block to the beginning of a page).
There is also Valgrind, which runs your program in a virtual CPU,
keeping track of what is yours and what is not.
Sorry for the HTML, it leaves in plain text but is converted by
our company's (MS) mail server.
--
Vincent Penquerc'h
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.linux.org.au/pipermail/linuxcprogramming/attachments/20030220/ab4b4754/attachment.htm
More information about the linuxCprogramming
mailing list