[Python-ideas] More details in MemoryError

Chris Angelico rosuav at gmail.com
Tue Jan 22 22:32:20 CET 2013


On Wed, Jan 23, 2013 at 5:27 AM, Antoine Pitrou <solipsis at pitrou.net> wrote:
> On Wed, 23 Jan 2013 00:04:15 +1100
> Chris Angelico <rosuav at gmail.com> wrote:
>> On Tue, Jan 22, 2013 at 11:42 PM, Steven D'Aprano <steve at pearwood.info> wrote:
>> > Something like this could be used to decide whether or not to flush
>> > unimportant in-memory caches, compact data structures, etc., or just
>> > give up and exit.
>>
>> That's a nice idea, but unless the requested allocation was fairly
>> large, there's a good chance you don't have room to allocate anything
>> more.
>
> I wouldn't be surprised if most cases of MemoryErrors were on fairly
> large allocation requests ;-)

Depends on the workflow. Something that allocates an immediate block
of memory, yes, but if you're progressively building a complex
structure, individual allocations mightn't themselves be significant.

ChrisA



More information about the Python-ideas mailing list