How to properly dispose a VSCode instance when its host iframe is destroyed? #803
Unanswered
andresalves01
asked this question in
Q&A
Replies: 1 comment 2 replies
-
|
I'm trying to understand what your current setup exactly is. Are you providing references to some VSCode objects to the top frame? Or are they sandbox iframes? If the iframes are sandbox, I don't see how just removing them can leak some memory 🤔 (except because of a browser bug ofc) |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment

Uh oh!
There was an error while loading. Please reload this page.
-
We have a product requirement that allows multiple VSCode instances to be active simultaneously within the same browser window. To isolate each Monaco service instance we use iframe as workaround to previous limitations (though we're aware the
sandboxapproach may now be a viable alternative). The issue is that, when an iframe is destroyed, some memory references don't appear to be released, the most visible symptom being Oniguruma WASM references accumulating across iframe lifecycles. The image below shows two new instantiations of Oniguruma's WASM after destroying the iframe twice.We believe this is likely a teardown problem on our end rather than a library bug, we're probably missing the correct disposal sequence before removing the iframe from the DOM. Is there a recommended way to fully "disconnect" a VSCode instance before its host iframe is destroyed? We're looking for the right sequence of disposables or lifecycle hooks that would properly release all allocated resources, such as WASM references, workers, event listeners, etc.
My environment setup is:
Thank you in advance for any help!
Beta Was this translation helpful? Give feedback.
All reactions