Skip to content
Discussion options

You must be logged in to vote

On cycles: yes, those get collected. On desktop targets current TinyGo uses the Boehm (bdwgc) collector by default: GOOS=darwin, linux and windows all set GC = "boehm" in compileopts/target.go. Older releases and other targets fall back to TinyGo's own conservative collector (config.go L166-174). Both are mark-and-sweep. They trace from the roots, so unreachable cycles are freed just like with gc. Reference cycles are only a problem for reference-counting collectors, which neither of these is.

The real difference is that both are conservative. Any word in memory that happens to look like a pointer into the heap keeps that block alive. In practice that means occasional over-retention, i.e.…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by pjebs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants