aboutsummaryrefslogtreecommitdiff
path: root/circuitpython/mpy-cross/gccollect.c
diff options
context:
space:
mode:
authorRaghuram Subramani <raghus2247@gmail.com>2022-06-19 19:47:51 +0530
committerRaghuram Subramani <raghus2247@gmail.com>2022-06-19 19:47:51 +0530
commit4fd287655a72b9aea14cdac715ad5b90ed082ed2 (patch)
tree65d393bc0e699dd12d05b29ba568e04cea666207 /circuitpython/mpy-cross/gccollect.c
parent0150f70ce9c39e9e6dd878766c0620c85e47bed0 (diff)
add circuitpython code
Diffstat (limited to 'circuitpython/mpy-cross/gccollect.c')
-rw-r--r--circuitpython/mpy-cross/gccollect.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/circuitpython/mpy-cross/gccollect.c b/circuitpython/mpy-cross/gccollect.c
new file mode 100644
index 0000000..79c47f3
--- /dev/null
+++ b/circuitpython/mpy-cross/gccollect.c
@@ -0,0 +1,21 @@
+// SPDX-FileCopyrightText: Copyright (c) 2013-2014 Damien P. George
+// SPDX-FileCopyrightText: 2014 MicroPython & CircuitPython contributors (https://github.com/adafruit/circuitpython/graphs/contributors)
+//
+// SPDX-License-Identifier: MIT
+
+#include <stdio.h>
+
+#include "py/mpstate.h"
+#include "py/gc.h"
+
+#include "shared/runtime/gchelper.h"
+
+#if MICROPY_ENABLE_GC
+
+void gc_collect(void) {
+ gc_collect_start();
+ gc_helper_collect_regs_and_stack();
+ gc_collect_end();
+}
+
+#endif // MICROPY_ENABLE_GC