How to deal with python 32bit memory error

Christian Heimes lists at cheimes.de
Tue Jul 24 13:07:54 CEST 2012


Am 24.07.2012 11:58, schrieb Dave Angel:
> 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.

The usable amount of memory is much lower than 4 GB for a 32bit program.
A typical program can use about 2.4 to 2.7 GB virtual address space for
heap. The exact amount is hard to predicate as it depends on the
operating system, memory allocator and other settings. The rest of the 4
GB virtual address space is reserved for stack, mapping of dynamic
libraries and operating system routines.

The amount of usable memory on the heap (area returned by malloc()) is
often lowered by memory fragmentation. If your program tries to malloc
100 MB of memory but the largest contiguous area is just 98 MB you'll
get a memory error, too.

Christian




More information about the Python-list mailing list