I am getting this error on my M1 iMac when running #PyCharm.
OSError: [Errno 12] Cannot allocate memory
I am running PyCharm 2023.2.1 (Community Addition) and Python 3.11.4
Any idea how to fix it. I did some searches and it mentions fixed that don't seem to work on a Mac. Any help would be appreciated.
Not to be trite, but is your machine actually out of memory? PyCharm / JetBrains' IDE is a memory hog. Running on my (Linux) machine right now, just the main process is occupying >6GB of RAM, and 25GB of vmem.
Apple Silicon Macs default to quite low amounts of memory - usually 8GB. If you didn't spring for at least another 8GB, I would not find it surprising for PyCharm to not be able to run correctly on that machine.
Okay, not 8GB.
The error number (12) matches up with failure to allocate memory, so it appears to be valid. This is happening at runtime, i.e. after it's been running awhile, rather than when starting up?
If so, I would think the likely cause is a memory leak in PyCharm - I've had them with various versions. The total allocated memory (core & swap) just keeps growing over time. Eventually your system runs out and gives you that error.
One version I had to restart daily.
[...]
If an updated version isn't available, and you don't want to downgrade to try that, you may be able to work around the problem temporarily by increasing the memory limits the process is operating under.
You can check what the current soft limits are - if you're using zsh, bash may differ slightly - with `ulimit -d -l -m -s -v -w`. Add the `-H` option to see the hard limits. The difference is soft limits can be raised by the user, up to the hard limit.
[...]
Then, using top or ps or similar tools, see how much of each of those PyCharm is using when it starts getting that error. If any of the values are close to the soft limits you have, you'll be able to increase them with the ulimit command - see the man page for your shell, it's a builtin function.
Sorry I can't give the exact commands; I don't have access to a Mac at the moment.