aboutsummaryrefslogtreecommitdiff
path: root/src/interp.c
diff options
context:
space:
mode:
authorMistivia <i@mistivia.com>2025-06-23 00:09:54 +0800
committerMistivia <i@mistivia.com>2025-06-23 00:12:58 +0800
commit957175b7f1bff57477ccd000c956bcbe06d159cf (patch)
tree73d5a368eda556dd56af0d89a40c97befd8084ff /src/interp.c
parent89f144d3ab27e54f7ad8cbf393418a3baa169f0f (diff)
test with intensive gc
Diffstat (limited to 'src/interp.c')
-rw-r--r--src/interp.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/interp.c b/src/interp.c
index 983ba8e..5a23d0b 100644
--- a/src/interp.c
+++ b/src/interp.c
@@ -140,6 +140,7 @@ void Interp_init(Interp *self) {
Interp_add_userfunc(self, "_gcstat", builtin_gcstat);
+ Interp_add_userfunc(self, "_alwaysgc", builtin_alwaysgc);
SExpRef ret = Interp_eval_string(self, bamboo_lisp_prelude);
Interp *interp = self;
@@ -249,7 +250,7 @@ void Interp_add_primitive(Interp *self, const char *name, LispPrimitive fn) {
void Interp_gc(Interp *interp, SExpRef tmproot) {
int freesize = IntVector_len(&interp->empty_space);
int heapsize = SExpVector_len(&interp->objs);
- if (freesize > heapsize >> 4) {
+ if (freesize > (heapsize >> 4) && !interp->alwaysgc) {
return;
}
SExpRefVector gcstack;