strange behaviour when writing a large amount of data on stdout

Bengt Richter bokr at
Thu Nov 24 12:18:12 CET 2005

On Wed, 23 Nov 2005 18:18:34 +0100, "Fredrik Lundh" <fredrik at> wrote:

>Manlio Perillo wrote:
>> >>>>> print data
>> >>
>> >> Traceback (most recent call last):
>> >>  File "xxx", line xxx, in ?
>> >>    print data
>> >> IOError: [Errno 12] Not enough space
>> >
>> >errno 12 is ENOMEM (that is, the system did not have enough memory
>> >to finish an operation).
>> However I think the error message is not a good one.
>> Better a "Not enough memory"
>the message text is provided by the operating system (or rather, by
>the C library).  I'm not sure rewriting error messages is a good thing...
>(if Python itself runs out of memory, it'll raise a MemoryError instead)
Maybe there's a bare except: somewhere blocking earlier & perhaps more informative

If windows has been running a long time (a few days or a week may be long ;-) it
may get fragmented in some smallish memory arena reserved for special things (I forgot
what versions, but I wouldn't be surprised if something still had s specialized limit).

Does the program involve dynamic generation of desktop icons by any chance? Especially
a lot of large true-color ones? I have some faint inkling of some correlation of that
and memory problems with still huge amounts of heap memory available.

Has the OP rebooted and just run the offending program alone?

BTW, if the OP wants to find out how much memory is on the windows system,
the amount of memory probably shows in the "about" window of the task manager
(the NT task manager will give you a scrolling real-time graph of different kinds
of memory usage as well). Also if the OP has windows word editor (probably winword.exe
will start it from the console command line), the "about" dialog may have a
"system info ..." button that will show memory and a lot more. What that button
runs is C:\Program Files\Common Files\Microsoft Shared\MSInfo\MSINFO32.exe
on my system. Since it's accessible from Word, I wouldn't think it would be
too unsafe to run, but I guess the OP might not want to start diagnostic things
on arbitrary devices etc., if that's accessible from his session.

Bengt Richter

More information about the Python-list mailing list