限制 Python VM 内存 [英] Limit Python VM memory
本文介绍了限制 Python VM 内存的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我试图找到一种方法来限制 Python VM 的可用内存,就像 Java VM 中的选项-Xmx"所做的那样.(这个想法是为了能够处理 MemoryError 异常)
I'm trying to find a way to limit the memory available for the Python VM, as the option "-Xmx" in the Java VM does. (The idea is to be able to play with the MemoryError exception)
我不确定这个选项是否存在,但可能有一个使用操作系统命令来隔离"进程及其内存的解决方案.
I'm not sure this option exist but there may be a solution using a command of the OS to "isolate" a process and its memory.
谢谢.
推荐答案
在 *nix 上,您可以使用 ulimit
命令,特别是 -m(最大内存大小)和 -v(虚拟记忆).
On *nix you can play around with the ulimit
command, specifically the -m (max memory size) and -v (virtual memory).
这篇关于限制 Python VM 内存的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文