PyCharm Running Out of Memory

Viewed 56794

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?

14 Answers

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

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.

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

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.

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."

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.

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

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.

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.

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.

Related