[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: Detecting Seg faults



Francesco Orsenigo wrote:

This leads me to suppose that some part of the code writes something it should not write and this is detected only when memory is allocated (the seg fault appears even if a quit from the game beyond a certain point, due to a call to free() i suppose).
Yep.

How can i find the point where the bad dereference happens, if the program is not crashing there?
Have you tried running it with 'valgrind' ?

Is there a way to force a more strict memory check?
Yes - do a 'man malloc' and you'll see there is a shell variable:

   MALLOC_CHECK_

(Note trailing underscore) which forces more careful checking in malloc/free.

I don't know how to use debugging, but it seems that it can't help track something happening far away from the fault, or am i wrong?
Yeah - it's one of the hardest things to find.

-----------------------------------------------------------------------
The second law of Frisbee throwing states: "Never precede any maneuver
by a comment more predictive than "Watch this!"...it turns out that
this also applies to writing Fragment Shaders.
-----------------------------------------------------------------------
Steve Baker                      (817)619-2657 (Vox/Vox-Mail)
L3Com/Link Simulation & Training (817)619-2466 (Fax)
Work: sjbaker@link.com           http://www.link.com
Home: sjbaker1@airmail.net       http://www.sjbaker.org