kopia lustrzana https://github.com/micropython/micropython
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
rodzic
ae6bcc9d23
commit
98a8ff7a1a
|
@ -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);
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue