fix a leak related to submodules
The leak caused compile-time environments to be retained until the next module complation, so it doesn't affect much.
This commit is contained in:
parent
86d5940139
commit
1f5d08dc29
|
@ -950,12 +950,20 @@ scheme_new_module_env(Scheme_Env *env, Scheme_Module *m, int new_exp_module_tree
|
|||
}
|
||||
|
||||
menv->module = m;
|
||||
|
||||
scheme_prepare_label_env(env);
|
||||
menv->label_env = env->label_env;
|
||||
menv->label_env->module_pre_registry = menv->module_pre_registry;
|
||||
menv->instance_env = env;
|
||||
|
||||
if (new_exp_module_tree) {
|
||||
/* It would be nice to share the label env with `env`, but we need
|
||||
to set `module_pre_registry` in `menv->label_env` and not shared
|
||||
it with `env->label_env`: */
|
||||
menv->label_env = NULL;
|
||||
scheme_prepare_label_env(menv);
|
||||
menv->instance_env = menv;
|
||||
} else {
|
||||
scheme_prepare_label_env(env);
|
||||
menv->label_env = env->label_env;
|
||||
}
|
||||
|
||||
if (new_exp_module_tree) {
|
||||
Scheme_Object *p;
|
||||
Scheme_Hash_Table *modules;
|
||||
|
|
|
@ -5331,7 +5331,7 @@ static Scheme_Env *instantiate_module(Scheme_Module *m, Scheme_Env *env, int res
|
|||
scheme_signal_error("internal error: shouldn't instantiate module %s now",
|
||||
scheme_write_to_string(m->modname, NULL));
|
||||
|
||||
/* printf("new %ld %s\n", env->phase, SCHEME_SYM_VAL(m->modname)); */
|
||||
/* printf("new %ld %s\n", env->phase, scheme_write_to_string(m->modname, NULL)); */
|
||||
menv = scheme_new_module_env(env, m, 0);
|
||||
scheme_hash_set(MODCHAIN_TABLE(env->modchain), m->modname, (Scheme_Object *)menv);
|
||||
|
||||
|
@ -6531,6 +6531,8 @@ static Scheme_Object *do_module_execute(Scheme_Object *data, Scheme_Env *genv,
|
|||
} else
|
||||
prefix = m->modname; /* used for submodules */
|
||||
|
||||
/* printf("declare %s\n", scheme_write_to_string(m->modname, NULL)); */
|
||||
|
||||
src = scheme_get_param(config, MZCONFIG_CURRENT_MODULE_SRC);
|
||||
if (!SCHEME_FALSEP(src)) {
|
||||
src = scheme_intern_resolved_module_path(src);
|
||||
|
|
Loading…
Reference in New Issue
Block a user