Stream: contributing

Topic: garbage collection


view this post on Zulip Matthew Phillips (Dec 04 2023 at 15:11):

I've been trying to understand the Roc codebase and one thing I'm having trouble with is understanding how garbage collection is done? I don't see any references in the codebase so I assume that's something Roc's getting in the rust layer some how?

view this post on Zulip Folkert de Vries (Dec 04 2023 at 15:21):

you mean the roc compiler (a rust program) or the output of that compiler (a roc program)

view this post on Zulip Matthew Phillips (Dec 04 2023 at 15:24):

roc program

view this post on Zulip Anton (Dec 04 2023 at 15:29):

We use reference counting instead of garbage collection. Richard has probably compared the two in a talk, but I don't think we have that written down somewhere.

view this post on Zulip Matthew Phillips (Dec 04 2023 at 15:32):

That's good to know! Did I miss it in the code?

view this post on Zulip Matthew Phillips (Dec 04 2023 at 15:34):

this a place to start maybe... https://github.com/roc-lang/roc/blob/7b1c009ca2bb07dc10a80136c1dccfc4de9996d2/crates/roc_std/src/storage.rs#L20

view this post on Zulip Anton (Dec 04 2023 at 15:39):

I did find a bit of documentation.
I think we most commonly use the term refcount in the codebase.

view this post on Zulip Anton (Dec 04 2023 at 15:41):

Lots of rc as well.

view this post on Zulip Matthew Phillips (Dec 04 2023 at 15:44):

Thank you, this helps a lot.


Last updated: Jul 06 2025 at 12:14 UTC