Python PyCharm 内存不足
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/36137671/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
PyCharm Running Out of Memory
提问by Batman
I've recently started getting an out of memory error while using PyCharm 5.0.4 The message is:
我最近在使用 PyCharm 5.0.4 时开始出现内存不足错误消息是:
There's not enough memory to perform the requested operation.
Please increase Xmx setting and shutdown PyCharm for change to take effect.
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.
我已经将值增加到 1024 MB,据我所知,我的 Python 或系统设置没有任何变化。
What exactly does the size of the Xmx memory manage, and how would I go about debugging what's causing the issue?
Xmx 内存的大小究竟管理什么,我将如何调试导致问题的原因?
采纳答案by Batman
Reinstalling PyCharm fixed this problem for me.
重新安装 PyCharm 为我解决了这个问题。
回答by BobInBaltimore
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.
当我遇到这个“内存不足”问题时,对我有用的是清除缓存。(“文件 -> 使缓存无效/重新启动...”)已经有几天了,没有进一步的问题。之前,它发生在启动 PyCharm 后五或十分钟,即使我在 PyCharm 上除了看它什么也没做。
I'm running PyCharm Community Edition 2016.1.4 on Windows 7 Enterprise.
我在 Windows 7 Enterprise 上运行 PyCharm Community Edition 2016.1.4。
回答by Stryker
I had the same issue where I keyboard on Pycharm was not responding anymore.
我遇到了同样的问题,我在 Pycharm 上的键盘不再响应。
The following solved my issue both on Windows 10 and MacOsx
以下解决了我在 Windows 10 和 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
回答by mtanha
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.
我有同样的问题。重新安装 PyCharm 没有帮助。我认为当我们的项目规模很大时会发生这个问题(也在https://youtrack.jetbrains.com/issue/PY-20429 中提到)。我只是从我的项目中剪切了一些文件夹,包括一些结果(txt 文件),并将它们保存在另一个目录中。现在,我没有收到“内存不足”错误,并且可以成功提交更改。
回答by kunl
There is already a bug reported for this in Youtrack: https://youtrack.jetbrains.com/issue/PY-20429
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.
正如那里的评论中所述,您可以尝试分析 CPU 使用情况(此处的说明https://intellij-support.jetbrains.com/hc/en-us/articles/207241235-Reporting-performance-problems)并在那里报告. 我注意到杀死我所有的调试器,将其置于省电模式,然后恢复它会有所帮助。
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.
如果您正在使用 docker,请注意 Pycharm 在创建多个 docker 实例而不是杀死它们方面存在一些问题。您将不得不手动杀死它们。
回答by longyu xu
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.
我只是从我的项目中剪切了一些文件夹,包括一些结果(txt 文件),并将它们保存在另一个目录中。现在,我没有收到“内存不足”错误,并且可以成功提交更改。
回答by stratosphere
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.
我的问题是安装在 Pycharm 中的 css 插件。删除它解决了问题。要删除,请转到 Pycharm 首选项中的项目解释器。
回答by Tae-Sung Shin
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.
在 PyCharm 中使用 Python 控制台运行脚本可能会将所有以前使用的变量保留在内存中,并且不会从控制台退出。因此,重复运行脚本可能会导致内存不足或无法在 GPU 或 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."
我在调试我的 tensorflow 代码时意识到了这一点。如果您不确定,请转到“运行”->“编辑配置”并确保取消选中“使用 Python 控制台运行”。
回答by BestChenMing
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.
我在更改背景图片时遇到了同样的问题,图片大小为 16.4MB。在此处输入图像描述,当我修改自定义 VM 选项并将 -Xxm 增加到 4096MB 时,它可以工作。但我不改变背景图像。