aboutsummaryrefslogtreecommitdiff
path: root/py/gc.h
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2014-10-31 21:30:46 +0000
committerDamien George <damien.p.george@gmail.com>2014-10-31 21:30:46 +0000
commit109c1de015eeee385020233e2f8cc6f921149103 (patch)
tree9cd3851ac9b580fcc7d84824bdf14c2bc968ee88 /py/gc.h
parent4029f51842656e7a1576dbe7c41aeea3eef83645 (diff)
py: Make gc.enable/disable just control auto-GC; alloc is still allowed.
gc.enable/disable are now the same as CPython: they just control whether automatic garbage collection is enabled or not. If disabled, you can still allocate heap memory, and initiate a manual collection.
Diffstat (limited to 'py/gc.h')
-rw-r--r--py/gc.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/py/gc.h b/py/gc.h
index dc276dd2b..69fe83752 100644
--- a/py/gc.h
+++ b/py/gc.h
@@ -32,6 +32,11 @@ void gc_lock(void);
void gc_unlock(void);
bool gc_is_locked(void);
+// This variable controls auto garbage collection. If set to 0 then the
+// GC won't automatically run when gc_alloc can't find enough blocks. But
+// you can still allocate/free memory and also explicitly call gc_collect.
+extern uint16_t gc_auto_collect_enabled;
+
// A given port must implement gc_collect by using the other collect functions.
void gc_collect(void);
void gc_collect_start(void);