[mercury-users] map and c_pointer

Tyson Dowd trd at cs.mu.OZ.AU
Mon Apr 15 23:47:40 AEST 2002


On 15-Apr-2002, Michael Day <mikeday at bigpond.net.au> wrote:
> 
> > Just as a side note, address comparison doesn't work for backends with
> > garbage collectors which move pointers.  In general it is not a good idea
> > to do things this way -- you should use a stable name for this kind
> > of code.  We don't have a general stable name system yet.
> 
> While interesting, surely this only matters for the case where you're
> manipulating Mercury allocated pointers for some nefarious back end
> specific purpose. If the pointers are allocated by an external C library
> then your garbage collector can't touch them and conservative garbage
> collection must be used in such cases.

This matters in any case in which objects may be moved around on the
heap, and pointers to these objects updated. 
It might include pointers allocated by an external C library.
It all depends how the library does memory management.
I must admit that very few C libraries would move things around in the
heap.

It does tend to happen when you copy something onto the Mercury heap
from the C heap, which is not particularly nefarious.

-- 
       Tyson Dowd           # 
                            #  Surreal humour isn't everyone's cup of fur.
     trd at cs.mu.oz.au        # 
http://www.cs.mu.oz.au/~trd #
--------------------------------------------------------------------------
mercury-users mailing list
post:  mercury-users at cs.mu.oz.au
administrative address: owner-mercury-users at cs.mu.oz.au
unsubscribe: Address: mercury-users-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-users-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the users mailing list