Re: [ooc-compiler] oo2c-2.0.18 allocator problem
Brought to you by:
mva
|
From: Frank C. <fj...@wo...> - 2004-02-11 02:49:08
|
On Wed, Feb 11, 2004 at 11:28:04AM +1100, fjc wrote:
> On Tue, Feb 10, 2004 at 08:06:46PM +0100, Tim Teulings wrote:
>
> > This is already fixed in CVS and if I remember correctly occured with
> > older version of oo2c, too.
Doh! Despite what I said it *does* happen in 2.0.17, I just screwed up the
test. That'll learn me to program after midnight, I'm too old for that stuff
anymore :-)
> > So it seems, like GC_MALLOC does not always clear memory?
It's not GC_MALLOC after all. I've just discovered that VisualPrefs sets
RT0.poisonHeap, so all allocated memory is filled with MAX(LONGINT). That
explains everything I experienced.
> The fact that a string doesn't get initialised isn't the issue, it's the
> possibility that objects can be created containing invalid pointers.
The bottom line appears to be that you simply cannot depend on pointers
being safe before they are explicitly initialised. You can't depend on
GC_MALLOC() clearing pointers in heap objects because it may not be linked
in and the system malloc() is used instead. On my system at least global
variables are cleared, but not procedure variables.
Knowing that I can proceed accordingly, but I think it puts an unwelcome
burden on programmers and makes programs less safe than they ought to be.
Frank Copeland
--
You can prove anything by mentioning another computer language. :-)
-- Larry Wall in <199...@wa...>
|