PyCharm Running Out of Memory

Question:

I’ve recently started getting an out of memory error while using PyCharm 5.0.4
The message is:

There's not enough memory to perform the requested operation.
Please increase Xmx setting and shutdown PyCharm for change to take effect.

I’ve already increased the value to 1024 MB, and to my knowledge nothing has changed in either my Python or system setups.

What exactly does the size of the Xmx memory manage, and how would I go about debugging what’s causing the issue?

Asked By: Batman

||

Answers:

There is already a bug reported for this in Youtrack:
https://youtrack.jetbrains.com/issue/PY-20429

As mentioned in the comments there, you can try to profile the CPU usage (instructions here https://intellij-support.jetbrains.com/hc/en-us/articles/207241235-Reporting-performance-problems) and report it there. I’ve noticed that killing all my debuggers, putting it in power save mode and then reverting this helps.

In case you are using docker, be aware that Pycharm has some problems with creating multiple docker instances and not killing them. You will have to kill them manually.

Answered By: kunl

Reinstalling PyCharm fixed this problem for me.

Answered By: Batman

I had the same problem. Reinstalling the PyCharm did not help. I think this problem happens when we have a large project size (also, mentioned in https://youtrack.jetbrains.com/issue/PY-20429). I simply cut some of the folders including some results (txt files) from my project and saved them in another directory. Now, I do not get the “out-of-memory” error and the changes can be committed successfully.

Answered By: mtanha

What worked for me when I ran into this “Out of Memory” problem was clearing the cache. (“File -> Invalidate Caches / Restart…”) It’s been a couple days and no further problems. Before, it was happening five or ten minutes after starting PyCharm, even with me not doing anything on PyCharm other than look at it.

I’m running PyCharm Community Edition 2016.1.4 on Windows 7 Enterprise.

Answered By: BobInBaltimore

I simply cut some of the folders including some results (txt files) from my project and saved them in another directory. Now, I do not get the “out-of-memory” error and the changes can be committed successfully.

Answered By: longyu xu

I had the same issue where I keyboard on Pycharm was not responding anymore.

The following solved my issue both on Windows 10 and MacOsx

Click on help on the menu

Help -> Edit custom VM options

Create the file when prompted.

Either change the settings to the following or replace the entire content of the file with the following:

-Xms512m
-Xmx2024m
-XX:MaxPermSize=700m
-XX:ReservedCodeCacheSize=480m
Answered By: Stryker

Running your script with Python Console in PyCharm might keep all previously used variables in memory and does not exit from the console. Thus, repeatedly running the script might cause out of memory or can’t allocate memory in GPU or CPU.

I realized this while debugging my tensorflow code. If you are not sure, go to Run -> Edit Configuration and make sure to uncheck “Run with Python Console.”

Answered By: Tae-Sung Shin

I had the same issue when I change the background image, the picture is 16.4MB.enter image description here, when I modify the Custom VM options and increase -Xxm to 4096MB, it works. But I do not change the background image.

Answered By: Darren Chen

The issue for me was the css plugin installed in Pycharm. Removing it fixed the problem. To remove, go to the Project Interpreter in Pycharm preferences.

Answered By: stratosphere

I couldn’t get the number at the bottom right to change (e.g. "300 of 768M"). Turns out it is Xmx memory and some of the options only seem to change Xms memory.

The answer about Help -> Edit Custom VM Options is correct (you can change is the different types of memory there).

Another thing that worked for me was on PC to set (in the DOS prompt, right before starting the application from that same DOS prompt) the _JAVA_OPTIONS value, e.g.:

set _JAVA_OPTIONS=-Xmx2048M
Answered By: Francois Bertrand

In my case, I had printed tons of output while running a cell. Pycharm could not cope up with this and constantly asked me to increase memory (even if I increased in).

I opened up the .ipynb file in notepad and deleted all the outputs. It worked.

Try to look for pieces of text titled as

"outputs": [
{
"name": "stdout",
"output_type": "stream",….

And just delete those.

Answered By: simpleParadox

I’m using Windows 10 and suddenly this message started popping up a lot, and even freezing Pycharm. My solution was delete the temporal files.

Windows + r: run/ or just write run, and execute: %temp%, then delete all of the files.

Answered By: PPK17

In my case I accidentally added a huge image to git (it weights about 1GB). This error only showed when I tried to make a commit. When I unmarked the image from git, the error stopped appearing.

Answered By: Embid123

In the latest pycharm edition, increase memory using below option

Help -> Change memory settings

Here enter the amount of memory you need.

enter image description here

Answered By: Sathiamoorthy
Categories: questions Tags: ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.