python 内存错误_可用内存时出现Python内存错误

在运行Python 3.6.5的64位Windows 10系统上,一个读取并分析文件的程序在尝试将字符串追加到列表时遇到内存错误。尽管系统的总内存使用率低于50%,但程序内存稳定在1635MB,接近32位程序在64位系统上的默认2GB内存限制。解决方法是确保使用64位版本的Python.exe运行程序。
摘要由CSDN通过智能技术生成

I have a Python program that reads lines of files and analyzes them. The program intentionally reads many lines into the RAM.

The program started getting MemoryError while appending a line (as str) to list. When I check in the task manager (the program runs on Windows 10), I see that the memory of the program is on 1635MB (stable) and the total memory use of the machine is below 50%.

I read that Python does not limit the memory, so what could be the reason?

Technical details:

I use Python 3.6.5 on Windows 10, 64-bit 16GB RAM machine. I run the program from the PowerShell terminal and not through the IDE.

解决方案I see that the memory of the program is on 1635MB

Windows EXEs compiled as 32-bit have, by default, a 2GB memory limit even when on 64-bit OS SKUs where plenty more memory is available. You're at 1.6 GB, so you're probably bumping up against this limit.

Make sure you are running the 64-bit version of Python.exe. Python.org's download page defaults to 32-bit for unknown reasons. But if you browse to the bottom of their download page for a given release, you can find the x86-64 version for 64-bit architecture.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值