[m-dev.] Re: ML_expand: attempt to use UNUSED tag!

Fergus Henderson fjh at cs.mu.oz.au
Wed Dec 31 03:07:02 AEDT 1997


On 30-Dec-1997, Tyson Dowd <trd at cs.mu.oz.au> wrote:
> > Mark Jones's paper about the implementation of Gofer says ...
> 
> Do you have this paper online or a reference to it?

Uh, somewhere...
I think it is in `/home/pgrad/fjh/papers/haskell/gofer_implementation.dvi.gz'.

> > runtime/mercury_deep_copy.c:
...
> > 	And fix a bug in deep_copy_type_info(): it should be
> > 	allocating memory using incr_saved_hp(), not using
> > 	make(). make() calls newmem(), which in non-conservative GC
> > 	grades calls malloc(), which results in a memory leak;
> 
> What do you mean by memory leak? The memory was freed immediately after use.

No, I'm talking about deep_copy_type_info(), not make_type_info().
The memory allocated by deep_copy_type_info() is not freed after use.

> If you're going to change the memory management, you'll need to
> update the documentation (which still talks about using malloc)
> in both files.

I'm afraid that for deep_copy_type_info() there's no such documentation
to update ;-).  But it doesn't really need much --- it's just a subroutine
of deep_copy() for the case where the thing it is copying is a type_info.
With my changes, make_type_info() still allocates using malloc();
but I changed deep_copy_type_info() to allocate using incr_saved_hp,
just as deep_copy() does.

-- 
Fergus Henderson <fjh at cs.mu.oz.au>   |  "I have always known that the pursuit
WWW: <http://www.cs.mu.oz.au/~fjh>   |  of excellence is a lethal habit"
PGP: finger fjh at 128.250.37.3         |     -- the last words of T. S. Garp.



More information about the developers mailing list