HaxeFoundation / HaxeFoundation/haxe

Macro interpreter memory leak, up to 24GB RAM usage observed

Open
#11,642 10 comments 0 reactions 0 assignees View on GitHub
Dominant language
Haxe
Stars
6.9k
Forks
715
Avg merge
2d 2h
Merged PRs (30d)
11

Description

When compiling a macro heavy project with vscode, we observed that `haxe.exe` 's memory usage grows quickly at each compile (and diagnostic) when the source is modified. It grow easily up to 24 GB before display memory details and 10 GB after display (there is a Ocaml GC call inside `get_memory_json`) which freeze the system. Restarting language server reset the cache size but does not stay for long (devs are restarting very regularly now 😭).

We suspect memory leak in macro interpreter. With some additional tracing on each variable of "macro interpreter", it shows the following result (knowing that after ocaml GC, the total cache size after the first build is less than 400MB, and average usage of another projects is around 1.5GB):

![image](https://github.com/HaxeFoundation/haxe/assets/22941109/649f258b-5d0e-43a2-8614-690bdeff5aae)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.