danii / hematita

A memory safe Lua interpreter
GNU General Public License v3.0
206 stars 13 forks source link

Garbage Collection #1

Open gahag opened 3 years ago

gahag commented 3 years ago

From what I've seen, the project currently handles memory with Arcs, which will leak on cyclic references. Are there plans to use a real garbage collector?

danii commented 3 years ago

I have plans to use a proper garbage collector but I don't have any details about it figured out at the moment. Any plans for how to implement something like this is welcome.

gahag commented 3 years ago

I have designed a language based on Lua, and implemented it using Rust. I used the gc crate for garbage collection, and it works wonders. The value enum is particularly similar to your implementation, but replacing Arc with Gc, of course. Perhaps this can be an interesting implementation strategy for garbage collection in Hematita.