[m-users.] MR_GC_free ?

Julien Fischer jfischer at opturion.com
Thu Nov 9 00:33:43 AEDT 2023


On Wed, 8 Nov 2023, Volker Wysk wrote:

>> MR_NEW and MR_free allocate and free memory using malloc() and free()
>> respectively, not with the GC.  It's safer to use the GC versions.
>> Additionally, foreign_procs that mix memory allocators, especially a
>> manual allocator, is likely be difficult to debug and maintain.
>
> This leads me to the same question as Peter's answer: Can the garbage
> collector see inside a C structure, if it is allocated with MR_GC_NEW?

Yes it can.  Bear in mind that the Boehm GC is designed to be garbage
collector for C; so far as it is concerned there is no distinction
between Mercury and C data structures.

Julien.


More information about the users mailing list