[Bug] High renderer memory retention with `wrappingStrategy: "advanced"` on large text in Electron (memory does not drop after closing file)
Maintainers usually reply within 1 day
@alexdima is already working on this.
Since Apr 29, 2026.
Assessment
This issue has not been assessed yet.
Description
Description
I'm using Monaco Editor in an Electron app as a read-only large text reader.
When wrappingStrategy is set to "advanced" and a large TXT file is loaded, renderer memory grows significantly and does not drop after closing the file (even after waiting and manual GC).
With "simple" wrapping, memory usually drops after a few seconds.
This looks like renderer-native memory retention (outside JS heap), potentially related to advanced wrapping/layout caches.
Environment
- Monaco Editor:
0.55.1 - Electron:
35.1.4 - OS: Windows 10 (10.0.19045)
- App mode: Renderer process in Electron, read-only editor
- Typical test file: ~50MB TXT (very large line count, ~900k+ lines in one sample)
Monaco configuration (relevant)
monaco.editor.create(container, {
readOnly: true,
wordWrap: "on",
wrappingStrategy: "advanced", // key trigger
automaticLayout: true,
minimap: { enabled: false },
lineNumbers: "off",
});
Reproduction Steps
- Launch Electron app (initial renderer memory is low, e.g. ~250MB).
- Open a large TXT file (~50MB).
- Wait until loading/rendering completes.
- Enable
wrappingStrategy: "advanced". - Observe renderer process memory in Process Explorer / Task Manager.
- Close the file (editor model is cleared/replaced by empty content).
- Wait 30+ seconds and trigger manual GC in DevTools Memory panel.
This is my application, which can reproduce this issue: https://github.com/ssnangua/ColorTxt/releases/tag/v1.4.2
Sorry, because it is aimed at Chinese users, so there is no English version yet, but you can refer to the example image below for instructions.
Actual (Problematic) Behavior
- With
"advanced", renderer memory rises sharply (often several GB in our tests) and does not noticeably drop after closing file, waiting, and manual GC. - DevTools JS heap remains relatively small (example: ~385MB), while renderer private bytes/working set remains very high (example: 4–6GB).
- Closing the renderer process/window releases memory immediately.
Expected Behavior
- Renderer memory should drop significantly after file close and GC (or within a reasonable delay), similar to
"simple"wrapping behavior.
Additional Context
- Same file with
wrappingStrategy: "simple":- memory increases during load/render,
- then usually drops after closing file (with some delay).
- Problem is strongly correlated with
"advanced"mode. - This does not look like a pure JS heap leak; it appears to be renderer-native/external memory retention.
Process-level evidence
In Electron process tree, the high memory is in the renderer process (not main process).
GPU process is not the main contributor in our case.
- Dominant language
- JavaScript
- Stars
- 47k
- Forks
- 4.2k
- Avg merge
- 3d 13h
- Merged PRs (30d)
- 13
Getting set up
Starts the project's dev container in your browser, under your own GitHub account.
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from microsoft/monaco-editor
-
Difficulty 1/5 1-3 hours Newbie friendliness 65/100
microsoft/monaco-editor#5626 ·
Maintainers usually reply within 1 day
-
[Bug] package.json `"typings"` points to a file which does not exist in the npm packagePossibly taken @whoalin1 claimed this 2 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
microsoft/monaco-editor#5615 ·
Maintainers usually reply within 1 day
-
[Bug] C# scientific-notation literals without a decimal point are split into identifiersPossibly taken @Janani-bn claimed this 15 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
microsoft/monaco-editor#5583 ·
Maintainers usually reply within 1 day
-
[Bug] Rust scientific-notation literals without an exponent sign are split into identifiersPossibly taken @Janani-bn claimed this 14 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
microsoft/monaco-editor#5582 ·
Maintainers usually reply within 1 day
-
[Bug] Go numeric literals with underscore separators are split into identifiersMay be free again @aaronanish-t claimed this 25 days ago, and no pull request is open. Open
Difficulty 2/5 1-3 hours Newbie friendliness 83/100
microsoft/monaco-editor#5577 · 1 comment ·
Maintainers usually reply within 1 day
All issues in microsoft/monaco-editor
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
quasarframework/quasar#18614 ·
Maintainers usually reply within 3 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
-
bug/1-unconfirmed kind/bug
Difficulty 1/5 Under an hour Newbie friendliness 90/100
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 86/100
521xueweihan/HelloGitHub#4714 ·
-
01 type: bug
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
Maintainers usually reply within 1 day