aboutsummaryrefslogtreecommitdiff
path: root/py/runtime.c
diff options
context:
space:
mode:
authormatejcik <ja@matejcik.cz>2021-03-22 11:20:22 +0100
committerDamien George <damien@micropython.org>2021-04-12 22:36:16 +1000
commit1a2ffda175bb5842617841362b2df40d7cfa97dd (patch)
tree9679be61398bd02684b77bed23e1b095d8f7fff9 /py/runtime.c
parentb26def0644b7f4c01cf616a24b6fe18f0737ebb6 (diff)
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).
Diffstat (limited to 'py/runtime.c')
-rw-r--r--py/runtime.c2
1 files changed, 1 insertions, 1 deletions
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);