hard memory limits

Fredrik Lundh fredrik at pythonware.com
Fri May 6 06:04:23 EDT 2005


Maurice LING wrote:

> I think I've hit a system limit in python when I try to construct a list
> of 200,000 elements.

there's no such limit in Python.

> My error is
>
> malloc: vm_allocate (size = 2400256) failed......
>
> Just wondering is this specific to my system or what?

that doesn't look like a Python error (Python usually raises
MemoryError exceptions when it runs out of memory), and
there's no sign of any vm_allocate function in the Python
sources, so yes, it's a system-specific problem.

> Will adding more RAM helps in this case?

probably.  more swap space might also help.  or you could use a
smarter malloc package.  posting more details on your platform,
toolchain, python version, and list building approach might also
help.

(are you perhaps building multiple lists piece by piece, interleaved
with other object allocations?  if so, it's probably a fragmentation
problem.  to check this, watch the process size.  if if grows at a
regular rate, and then explodes just before you get the above error,
you may need to reconsider the design a bit).

</F>






More information about the Python-list mailing list