trealla-prolog / trealla

A compact, efficient Prolog interpreter written in plain-old C.
MIT License
264 stars 13 forks source link

garbage collection #9

Open jfmc opened 2 years ago

jfmc commented 2 years ago

Hi! Is there any documentation about the GC algorithm implemented in Trealla?

I'm curious about this: "Dynamic atoms are automatically garbage collected"

infradig commented 2 years ago

They are just ref-counted and freed on zero. And not talking about regular atoms (such as functors)..

On Tue, Aug 16, 2022 at 6:28 PM Jose F. Morales @.***> wrote:

Hi! Is there any documentation about the GC algorithm implemented in Trealla?

I'm curious about this: "Dynamic atoms are automatically garbage collected"

— Reply to this email directly, view it on GitHub https://github.com/trealla-prolog/trealla/issues/9, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFNKSEQVHMJX3QX3C3RQ2CTVZNGMDANCNFSM56U4JQTA . You are receiving this because you are subscribed to this thread.Message ID: @.***>

jfmc commented 2 years ago

Does Trealla use tracing GC? (e.g., mark-sweep-compact) (update: I've seen it is in the TODO list: https://github.com/trealla-prolog/trealla/blob/fd9b7e25a63689c345004c23e6c28f4a12957db9/src/heap.c#L151)

When is RC incremented/decremented for such atoms? I know that this is an implementation detail but it may be good for users to known when and how memory is reclaimed.