The following message keeps appearing when I use VS code:
Pylance has crashed. Would you like to try using a Node.js executable to run the language server?
I wanted to solve the problem so I clicked the message and the following image shows up:
As suggested in the message you provided, the crash is caused by the pointer compression enabled in VS code.
This feature is first enabled to reduce the V8 heap size (by up to 40%) and to save Chrome’s renderer process memory (by up to 20%). Electron follows Chrome and makes the same decision.
By default, Pylance runs using VS Code's Node.js executable, which has a memory limit of 4 GB. If you have a Node.js executable installed, providing its location will prioritize its use.
For example, on Windows, you can check your Node.js installation by:
> where node
C:\Program Files\nodejs\node.exe
Paste the location above, or set it in settings.json,
"python.analysis.nodeExecutable": "C:\Program Files\nodejs\node.exe"
will automatically restart the Pylance instance.
Of course, restarting VS code can solve the crash for a while. It's still recommended to replace the Node.js executable or further exclude unneeded *.py files to save memory.
i just had the same problem , Pylance has crashed. Would you like to try using a Node.js executable to run the language server? i solved it by one closing all open tap it is actually a memory problem for me close all open tabs the restart you computer and if you dont have space clean up that should solve the proble atleast it solved it for me .
Through the System Properties Window Open System Properties:
Right-click on This PC or Computer on the desktop or in File Explorer. Select Properties. Click on Advanced system settings on the left side. In the System Properties window, click on the Environment Variables button at the bottom. Add a New Environment Variable:
In the Environment Variables window, under the System variables section, click on New. For the Variable name, enter NODE_OPTIONS. For the Variable value, enter --max-old-space-size=8192. Click OK to save the new variable. Apply and Close:
Click OK again to close the Environment Variables window. Click OK to close the System Properties window. You may need to restart your computer for the changes to take effect system-wide. By following either of these methods, you can set the NODE_OPTIONS environment variable to increase the memory limit for Node.js processes on your Windows system.