I recently used VS code to open a large file by opening from the command line using the command line flag --max-memory=12288mb
. I was able to edit the file fine and finished what I needed to do and then closed code as normal.
By default I have the restoreWindows
and hotExit
settings enabled, so that when I re-open code all the previous files are enabled.
After this whenever I open a VS Code via the shortcut or context menu, it attempts to re-open the large file and crashes within ~10 seconds of starting. And displays the warning:
The Window Has Crashed
We are sorry for the inconvenience! You can reopen the window to continue where you left off
I tried a few steps to attempt to close/prevent the file reopening all during the functioning 10 seconds:
Close Editor
, Close Folder
and Close Window
options in the file menu"window.restoreWindows": "none"
and "files.hotExit": "off"
to try and prevent the file from automatically being reloadedI have also tried running VS Code with extensions disabled
If you experience crashes of Visual Studio, typically when working with a very large solution, your IDE might be out of virtual memory. Typical indicators of the problem include a "one or more errors occurred" message, "the process appears to be deadlocked" message, and OutOfMemory exception in a crash dump.
VS Code can't handle very large files (multi-GiB), but Sublime can. Hacker News. VS Code can't handle very large files (multi-GiB), but Sublime can.
View > Appearance > Reset Zoom (Ctrl+Numpad0) - reset the Zoom level to 0.
The solution was to start VS Code from the command line again with the following command
code --disable-extensions --max-memory=12288mb
Then to close the offending file and correctly exit VS Code without any open files. This then prevent VS Code from attempting to re-open the large file when restarting.
I believe that this is a bug in VS Code as it feels as though it should display the same warning to restart with the correct memory when re-loading files as it does when first attempting to open the file. I've raised a bug with MS here.
Hopefully this helps someone!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With