[Python-Dev] MemoryError... how much memory?

Antoine Pitrou solipsis at pitrou.net
Thu Oct 28 16:19:34 CEST 2010

On Thu, 28 Oct 2010 15:54:50 +0200
Georg Brandl <g.brandl at gmx.net> wrote:
> Am 28.10.2010 15:14, schrieb "Martin v. Löwis":
> >> Furthermore, our server is fairly complex: we're using quite some
> >> libraries to do different jobs, and one of the approaches (not the
> >> only one) that we're taking to deal with this beast is to analyze its
> >> memory-related behaviour from an external POV (thinking it as a black
> >> box).
> >> 
> >> So, beyond it's arguable utility, do you think that having that
> >> information could harm us in some way?
> > 
> > I think implementing it might do harm. When a memory error is raised,
> > you are typically out of memory, so allocating more memory might fail
> > (it just did). Therefore, allocating more objects or doing string
> > formatting will likely fail (unless the requested size is much larger
> > than the memory required for these operations).
> > 
> > So the chance increases that you trigger a fatal error.
> Especially since we have a MemoryError instance preallocated to avoid
> exactly this problem.

And which creates other problems of its own, such as keeping many
objects alive:



More information about the Python-Dev mailing list