Here's the code that generates error 6624, "XML document
could not be created because server memory is low. Use
sp_xml_removedocument to release XML documents":

declare @iXmlDoc int
declare @vcXml VARCHAR(1000)
set @vcXml = '<root><Obj Id="3578"/>,<Obj Id="3591"/>,<Obj
Id="3722"/>,<Obj Id="3703"/>,<Obj Id="3693"/>,<Obj
Id="3771"/>,<Obj Id="3829"/></root>'
exec sp_xml_preparedocument @iXmlDoc output, @vcXml
exec GetOrderedMultiTxtXml$ @iXmlDoc, 5001, 1
exec sp_xml_removedocument @iXmlDoc

The problem occurs on Windows 98. This particular machine
has only 64 Mb of memory. We manually changed virtual
memory to 256 minimum and a gig max, with no change in the