webassembly: Add support for enabling MICROPY_GC_SPLIT_HEAP_AUTO.

When enabled the GC will not reclaim any memory on a call to
`gc_collect()`.  Instead it will grow the heap.

Signed-off-by: Damien George <damien@micropython.org>
pull/13583/head
Damien George 2023-06-22 17:31:40 +10:00
rodzic ae6bcc9d23
commit 98a8ff7a1a
2 zmienionych plików z 16 dodań i 0 usunięć

Wyświetl plik

@ -113,6 +113,19 @@ void mp_js_init_repl() {
pyexec_event_repl_init();
}
#if MICROPY_GC_SPLIT_HEAP_AUTO
// The largest new region that is available to become Python heap.
size_t gc_get_max_new_split(void) {
return 128 * 1024 * 1024;
}
// Don't collect anything. Instead require the heap to grow.
void gc_collect(void) {
}
#else
static void gc_scan_func(void *begin, void *end) {
gc_collect_root((void **)begin, (void **)end - (void **)begin + 1);
}
@ -124,6 +137,8 @@ void gc_collect(void) {
gc_collect_end();
}
#endif
#if !MICROPY_VFS
mp_lexer_t *mp_lexer_new_from_file(qstr filename) {
mp_raise_OSError(MP_ENOENT);

Wyświetl plik

@ -26,6 +26,7 @@
*/
#include <stdint.h>
#include <stdlib.h> // for malloc, for MICROPY_GC_SPLIT_HEAP_AUTO
// options to control how MicroPython is built