Open Simn opened 2 years ago
Can be related to https://github.com/HaxeFoundation/haxe/issues/10511
The problem here is that the exception handling does load_instance
after typing. This ends up in load_module
, which does execute add_dependency ctx.m.curmod m2
. However, during filtering, ctx.m
isn't set correctly, so the dependency isn't added to the actual module. I have confirmed that this issue is fixed by changing ctx.m
in run_expression_filters
.
We're really not doing us any favors by having a typer context in the post-compilation stage. But this isn't going to be easy to change because some transformations such as inlining depend on it. I'll commit the curmod
change for now, but in the long run I'd like to try and introduce some kind of filtering context that has a common
context, but not a typer
one.
I've seen this leak on macro context btw
If you get a hold of a scenario where this reproduces, please try adding tctx.m <- TypeloadModule.make_curmod tctx.com tctx.g c.cl_module;
in filters.ml destruction
next to the tctx.c.curclass <- c
there.
I noticed today that a hello world program reports these memory leaks on neko:
This is probably not a major issue, but I'm still pretty curious what's going on there.