[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Total vs per-cpu memory



On Fri, Feb 01, 2008 at 04:10:25PM +0100, Gudjon I. Gudjonsson wrote:
> Since you are discussing this. I spent yesterday on trying to debug
> ngspice on amd64 with gdb and valgrind. It segfaults on amd64 but not on
> i386. Can you point out some good documents on where to put those checks
> you mention?

The main thing to watch out for it people using int's as pointers.
pointers should always be void * or longs.

Do you have an example of how to make it segfault?

>    Unfortunately often I don't know when a data structure can be freed.

When you know you won't try to access it again.  Also setting the
pointer to NULL after freeing it and then checking that a pointer is not
NULL before trying to access it (and if it is null when you don't think
it should be, spit out an error message).

--
Len Sorensen


Reply to: