tinygo icon indicating copy to clipboard operation
tinygo copied to clipboard

What kind of GC is `-gc=precise`?

Open vlkv opened this issue 2 years ago • 2 comments

Hello! There is no info about -gc=precise option on https://tinygo.org/docs/reference/usage/important-options/ page. But such option definitely exists, because of https://github.com/tinygo-org/tinygo/blob/731532cd2b6353b60b443343b51296ec0fafae09/compileopts/options.go#L11

tinygo --help also says not much:

  -gc string
    	garbage collector to use (none, leaking, conservative)

Can you please explain what is this kind of GC and what are its pros/cons (compared to 'conservative')?

Thank you.

vlkv avatar Nov 16 '23 14:11 vlkv

Please, can somebody respond?..

vlkv avatar May 31 '24 12:05 vlkv

It's almost the same as the conservative GC, but tracks which area of memory definitely aren't pointers. So it has a smaller chance of false positives (which means reduced memory consumption) and may or may not be faster (depending on your use case). It's still mostly conservative, but a bit smarter.

This should really be added to the website.

aykevl avatar Jun 07 '24 12:06 aykevl