Stream: platform development

Topic: ✔ Refcounted vs non-refcounted Lists


view this post on Zulip Bryce Miller (Jun 22 2026 at 13:33):

I see the code generated by glue allows me to create a RocList with or without space for a ref count.

If a list isn’t ref counted, does that mean it will never get dropped?

Context: I have hosted functions that return a List, and Claude reached for the non-ref counted list when asked to implement them.

When I do return an ref counted list, should I be incrementing the ref count before I return it?

view this post on Zulip Bryce Miller (Jun 22 2026 at 16:18):

Ah, I typed this out on my phone when I wasn’t looking at the code. The flag is elements_refcounted, so it’s indicating whether list elements have ref counts that need to be decremented when we decref the list. Is that correct?

view this post on Zulip Bryce Miller (Jun 22 2026 at 17:04):

And the flag exists to signal the correct size of the list header so that it can support seamless slices? I realized that I’ve stumbled into trying to understand ref counting again :sweat_smile:

But if I’m correct in my understanding that I just need elements_refcouted to be true when the elements are heap allocated, that’s all I need for now.

view this post on Zulip Notification Bot (Jun 22 2026 at 17:04):

Bryce Miller has marked this topic as resolved.


Last updated: Jul 23 2026 at 13:15 UTC