[XML-SIG] DOM memory problem

Andrew Clover and-xml at doxdesk.com
Sun Feb 1 07:43:42 EST 2004

Bruce Jewell <bruce.jewell at symmetron.com> wrote:

> My problem is that this threw an exception IOError:[Errno 12]Not
> enough space.

You're using Windows, right? sys.stdin behaves oddly under Python for
Windows, it's not a PyXML-specific problem. Was mentioned here with no
obvious solution:


(On Win 9x, stdout may be affected too, judging by this:)


PyXML is trying to read stdin to an arbitrarily-sized buffer. If the buffer
is larger than a certain critical size, Windows will give it an IOError.
This size is 0x6FFF on my Py2.3/WinXP setup, unless Python is run with the
-u switch in which case (for some reason) it is 0x4FFF. This may vary; 1.5.2
also seems to get stuck at 0x4FFFF.

Currently xml.sax.xmlreader is defaulting to 0x10000:

    def __init__(self, bufsize=2**16):

if this line (111) is changed to 0x4000 it seems to make the problems go

It may be worth making this change to PyXML to avoid this problem cropping
up for Win users. But in the longer term think Python itself ought to
include a workaround (assuming it is indeed a bug in Microsoft's stdio

Andrew Clover
mailto:and at doxdesk.com

More information about the XML-SIG mailing list