added cosmoM_addRoot & cosmoM_removeRoot

This commit is contained in:
2020-12-07 15:53:23 -06:00
parent aff011a8d1
commit f8a062919f
8 changed files with 71 additions and 6 deletions

View File

@@ -32,6 +32,7 @@ typedef struct CState {
bool panic;
int freezeGC; // when > 0, GC events will be ignored (for internal use)
CObj *objects; // tracks all of our allocated objects
CObj *userRoots; // user definable roots, this holds CObjs that should be considered "roots", lets the VM know you are holding a reference to a CObj in your code
ArrayCObj grayStack; // keeps track of which objects *haven't yet* been traversed in our GC, but *have been* found
size_t allocatedBytes;
size_t nextGC; // when allocatedBytes reaches this threshhold, trigger a GC event