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

Re: C programming: Segmentation fault within malloc?



Richard Cobbe writes:
 > heap.  Unfortunately, this may or may not be the location of the root
 > error.  While I'm a big fan of garbage collectors in general, I don't think

You can always hope that it's a piece of memory you were dealing with
before.  Depending on the malloc debugger, you may also be able to see 
whose memory you're stepping on (if anybody's).

 > that using one here will help you find the cause of this crash.  When you've
 > got a GC, you typically don't ever call free(), and a GC won't protect much
 > against the last two causes I mentioned above.  As a result, it will most
 > likely hide the bug, or not affect it at all.

Ah, but it does give you info, which helps.  If the bug disappears,
you know it's something only a GC could fix (unless the bug is
non-reproducible)--okay, even then, it's still only a good probability 
since the GC will change memory access patterns.  If it doesn't
disappear, then you're doing something nastier with the memory.
Again, probably, but all clues help with memory debugging.

Andrew.



Reply to: