1
0
mirror of https://github.com/janet-lang/janet synced 2025-10-29 22:53:03 +00:00

Add weak references in the form of weak tables.

Any references exclusively held by a weak table may be collected
without the programmer needing to free references manually. A table
can be setup to have weak keys, weak values, or both.
This commit is contained in:
Calvin Rose
2023-09-27 23:27:48 -05:00
parent b63d41102e
commit b3a6e25ce0
6 changed files with 170 additions and 9 deletions

View File

@@ -121,6 +121,7 @@ struct JanetVM {
/* Garbage collection */
void *blocks;
void *weak_blocks;
size_t gc_interval;
size_t next_collection;
size_t block_count;