[mercury-users] Heap space limited for C when called from Mercury?

Ondrej Bojar oboj7042 at ss1000.ms.mff.cuni.cz
Tue Mar 11 21:18:23 AEDT 2003


On Tue, 11 Mar 2003, Fergus Henderson wrote:
> One thing to be careful about is putting (pointers to) Mercury data
> structures on the C heap.  The Boehm (et al) conservative garbage
> collector, which is used by the Mercury implementation, will not scan
> areas allocated with malloc() or with the standard "new".  So you must
> make sure that any Mercury data structures pointed to from the C heap
> are also pointed to from somewhere else (e.g. C global variables, the
> C stack, or the Mercury stack(s)).

Does this mean, that if I do not keep a pointer to the data on C global
variables, C stack or Mercury stack then the garbage collector might
(will) release the data from the memory. And then, when I look up the
"extra" pointer stored on the C heap and dereference it, I touch the
released memory block. Did I get it correctly?

Thanks, Andrew.

--------------------------------------------------------------------------
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