How to deal with python 32bit memory error

Dave Angel d at davea.name
Tue Jul 24 11:58:25 CEST 2012


On 07/24/2012 04:06 AM, Sammy Danso wrote:
> Hello Experts,
> I am having a 'memory error',

Please post the actual error message.

>  which suggest that I 
> have run out of memory, but I am not sure this is the case as I have 
> considerable amount of memory unused on my computer. 

What OS, version, and bitness.  What 32bit Python?

How do you know you have unused memory?  How much total memory, how much
swapspace, and what are you using to tell how much of each is unused?

How big is the process when it dies?  And how are you determining that?

> A little 
> search suggest this is a limitation of python 32 and an option is to 
> have a 64bit. I however have other plug-ins, which are tied to the 32bit
>  so this is not the best option in my case. 
There are some limitations to 32 bits, that have nothing to do with
Python specifically.  However, they have different impact, depending on
the environment you're running in.  First and foremost, address are
32bits, which limits them to 4gb of ram.  So out of your 32Gig of
swapspace, a best-case maximum regardless of OS is 4Gig.  No operating
system lets you actually get that high.

> I was wondering whether there is an elegant way to dealing with this without installing a 6bit version of python.

The most elegant way of solving it is to reduce the amount of memory
your program is using.  For example, instead of building large lists,
perhaps you can use generators.  Simplest example (for Python 2.x) is
xrange rather than range.

For another example, reduce the globals.  Create large objects inside a
limited function, and discard them when done (by returning from the
function).

> Thanks very much in advance.
> Sammy
>

When responding, please remember to post your response *AFTER* the part
you're quoting.  Most of your previous posts here have been top-posted.

-- 

DaveA




More information about the Python-list mailing list