|
![](/i/fill.gif) |
In article <384fcfb1@news.povray.org>, "Thorsten Froehlich"
<tho### [at] trf de> wrote:
> Not reproducible crashes, especially on the Mac are most likely caused by
> invalid pointers or other out of range addressing. As the Mac OS does not
> have full memory protection (yet) these bugs are hard to catch.
Yes, I understand that.
> - Use the MacsBug "hs" command to turn on/off heap scrambling.
What exactly is heap scrambling? I know of this command, but I don't
know what it does.
Also, do you know of a good reference to MacsBug which is available
online?
> - When you free memory a pointer points to, set the pointer to NULL.
> - Init all pointers and data structures you use to NULL before using them
> (even if it looks stupid, i.e. code _should_ always put something into a
> pointer).
Well, I normally do this, but this is happening just before the data
structure containing those pointers is destroyed, and those pointers are
not used after their targets are destroyed. That was the first thing I
looked at, though.
> In general, you should then see either hard crashes (mostly with "hs" on)
> or memory access faults when your program tries to write to memory locations
> around 0 which are protected by the system. You will also see failing
> free calls if the pointers are set to NULL and somewhere code tries to free
> that memory again.
Well, I think the problem was basically that a function was destroying a
data structure which I thought I had to destroy separately. Setting the
pointer to NULL after the call to the first one wouldn't have made sense
had that been the case, because the first thing I did after that call
was use POV_FREE on that pointer.
Thanks for the advice, I will be more careful about pointers in the
future.
--
Chris Huff
e-mail: chr### [at] yahoo com
Web page: http://chrishuff.dhs.org/
Post a reply to this message
|
![](/i/fill.gif) |