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

Georg Brandl g.brandl at gmx.net
Thu Oct 28 15:54:50 CEST 2010


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.

Georg

-- 
Thus spake the Lord: Thou shalt indent with four spaces. No more, no less.
Four shall be the number of spaces thou shalt indent, and the number of thy
indenting shall be four. Eight shalt thou not indent, nor either indent thou
two, excepting that thou then proceed to four. Tabs are right out.



More information about the Python-Dev mailing list