From 1a2ffda175bb5842617841362b2df40d7cfa97dd Mon Sep 17 00:00:00 2001 From: matejcik Date: Mon, 22 Mar 2021 11:20:22 +0100 Subject: py/runtime: Make sys.modules preallocate to a configurable size. This allows configuring the pre-allocated size of sys.modules dict, in order to prevent unwanted reallocations at run-time (3 sys-modules is really not quite enough for a larger project). --- py/runtime.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'py/runtime.c') diff --git a/py/runtime.c b/py/runtime.c index 5d476a276..0ce685473 100644 --- a/py/runtime.c +++ b/py/runtime.c @@ -91,7 +91,7 @@ void mp_init(void) { #endif // init global module dict - mp_obj_dict_init(&MP_STATE_VM(mp_loaded_modules_dict), 3); + mp_obj_dict_init(&MP_STATE_VM(mp_loaded_modules_dict), MICROPY_LOADED_MODULES_DICT_SIZE); // initialise the __main__ module mp_obj_dict_init(&MP_STATE_VM(dict_main), 1); -- cgit v1.2.3