POV-Ray : Newsgroups : povray.unofficial.patches : Bug in pigment object (Chris Huff's patch) : Re: Bug in pigment object (Chris Huff's patch) Server Time
2 Sep 2024 16:17:04 EDT (-0400)
  Re: Bug in pigment object (Chris Huff's patch)  
From: Chris Huff
Date: 9 Dec 1999 15:34:24
Message: <chrishuff_99-F20740.15344609121999@news.povray.org>
In article <384fcfb1@news.povray.org>, "Thorsten Froehlich" 
<tho### [at] trfde> 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] yahoocom
Web page: http://chrishuff.dhs.org/


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.