python内存溢出_python代码内存溢出报错
环境是
4核+8G的7.3CentOS系统(强调,系统是64位的)
[2018-07-03 15:37:58,098][MainThread:140513684158528][task_id:ice_signal][notice_signal.py:1011] [ERROR]['>=' not supported between instances of 'str' and 'int']
[2018-07-03 15:54:26,825][b'uWSGIWorker5Core0':140397*********][task_quest][exception.py:135] [ERROR][Internal Server Error: /api/v1/XXX/]
Traceback (most recent call last):
File "/usr/local/python3.6.2/lib/python3.6/site-packages/django/core/handlers/exception.py", line 41, in inner
respon = get_respon(request)英语通知范文
File "/usr/local/python3.6.2/lib/python3.6/site-packages/django/core/handlers/ba.py", line 217, in _get_respon
respon = lf.process_exception_by_middleware(e, request)
File "/usr/local/python3.6.2/lib/python3.6/site-packages/django/core/handlers/ba.py", line 215, in _get_respon
respon = der()
File "/usr/local/python3.6.2/lib/python3.6/site-packages/django/template/respon.py", line 107, in renderutilities
File "/usr/local/python3.6.2/lib/python3.6/site-packages/rest_framework/respon.py", line 72, in rendered_content
过去将来时ret = der(lf.data, accepted_media_type, context)
少儿口才培训File "/usr/local/python3.6.2/lib/python3.6/site-packages/rest_framework/renderers.py", line 105, in render2013陕西高考英语
parators=parators
File "/usr/local/python3.6.2/lib/python3.6/json/__init__.py", line 238, in dumps
**kw).encode(obj)
File "/usr/local/python3.6.2/lib/python3.6/json/encoder.py", line 199, in encodehostage
chunks = lf.iterencode(o, _one_shot=True)
tpmsFile "/usr/local/python3.6.2/lib/python3.6/json/encoder.py", line 257, in iterencode
return _iterencode(o, 0)
MemoryError
这种内存溢出错误。⼀旦报错就是⼀堆堆的报错,完全找不到头绪,
找了好久发现这种错误主要是两点原因。
1.Python解释器是32位的(或者只⽀持32位),当内存使⽤率到了2GB以上之后,就会内存溢出,好⽐ java设置了2G
2.代码级别的循环调⽤,百度⼀下有很多这个原因的。
wholefoods
解决⽅案重新编译安装python解释器
ugc是什么意思./configure --prefix=/usr/local/python3.6.2 --with-ssl --with-universal-archs=all
make
make install
mfc是什么
其中 --with-universal-archs=all
lect architectures for universal build ("32-bit","64-bit", "3-way", "intel", "intel-32", or "all")选择 architectures进⾏构建,然后我选择了all进⾏构建。其中 intel是英特尔芯⽚的意思。