Re: writing to freed memory--issues
- From: "Chris F.A. Johnson" <cfajohnson@xxxxxxxxx>
- Date: Wed, 29 Mar 2006 00:59:09 -0500
On 2006-03-29, Kasper Dupont wrote:
Måns Rullgård wrote:
Kasper Dupont
<22187600027978126515@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx> writes:
If your program printed the actual address it might be a lot
easier to figure out why it behaves the way it does. Something
like fprintf(stderr,"%08x\n",a); (assuming a 32 bit architecture,
on a 64 bit architecture you'd want 16 digits of the pointer).
Or use %p.
That is also an option. But I usually avoid %p because I have
not figured out a way to make it include leading zeros in the
address. On my system this piece of code prints the address
with only 7 digits not 8 like I want:
#include <stdio.h>
int main()
{
printf("%p\n",main);
To get leading zeros:
printf("%010p\n",main); /* 10 places to allow for 0x */
return 0;
}
--
Chris F.A. Johnson, author | <http://cfaj.freeshell.org>
Shell Scripting Recipes: | My code in this post, if any,
A Problem-Solution Approach | is released under the
2005, Apress | GNU General Public Licence
.
- References:
- writing to freed memory--issues
- From: bill pursell
- Re: writing to freed memory--issues
- From: bill pursell
- Re: writing to freed memory--issues
- From: Måns Rullgård
- writing to freed memory--issues
- Prev by Date: Re: what's the relation among wxWidgets,xWindows and GTK+?
- Next by Date: Re: Strange pager (less, more) behavior
- Previous by thread: Re: writing to freed memory--issues
- Next by thread: Re: writing to freed memory--issues
- Index(es):