anole-lang / anole

The Anole Programming Language
MIT License
17 stars 1 forks source link

[REDESIGN] GC for objects instead of variables #13

Closed mu001999 closed 4 years ago

mu001999 commented 4 years ago

Current solution of GC is to collect variables, but many temporary variables will be created when pushing something into Context. And each variable may contain a shared_ptr to one object, so the object won't be released until the variable is released.

So another plan is to collect objects instead of variables and use shared_ptr of variables, then variables could be released in real time. And objects would be released when GC.

Something different is that variables and objects will be released at the same time in the former one, but in the latter variables could be released before objects.

mu001999 commented 4 years ago

TODO: Design the binded systerm to make sure each object could be collected