467,915 Members | 1,142 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 467,915 developers. It's quick & easy.

XslTransform memory overload

Hi.

I'm using XslTransform to transform a XML resulting of a Dataset into a
Excel spreadsheet.
But the object is not releasing its resources while transforming and
I'm getting OutOfMemory errors.

The memory consumed by the process exceeds the size of 306 MB and the
IIS process is recycled, resulting in a "Server Application
Unavailable" error message. The size of the XML result might be 15MB.

The memory of process grows during de Transform method call.

I've already tried use a FileStream to keep memory free but has no
effect.

Any ideas?
Thanks.

Apr 4 '06 #1
  • viewed: 1578
Share:
3 Replies


ar*****@gmail.com wrote:
I'm using XslTransform to transform a XML resulting of a Dataset into a
Excel spreadsheet.
But the object is not releasing its resources while transforming and
I'm getting OutOfMemory errors.

The memory consumed by the process exceeds the size of 306 MB and the
IIS process is recycled, resulting in a "Server Application
Unavailable" error message. The size of the XML result might be 15MB.

The memory of process grows during de Transform method call.


Which overload of the Transform method exactly do you use, could you
show the code how exactly you call the Transform method, what kind of
arguments you pass in? Have you debugged that stylesheet outside of an
ASP.NET/IIS application to check whether there are no problems with the
stylesheet? What's the size of the input XML?

--

Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/
Apr 4 '06 #2
Would you please share your code and data? We will look at it.

Thanks,
Zafar
<ar*****@gmail.com> wrote in message
news:11*********************@z34g2000cwc.googlegro ups.com...
Hi.

I'm using XslTransform to transform a XML resulting of a Dataset into a
Excel spreadsheet.
But the object is not releasing its resources while transforming and
I'm getting OutOfMemory errors.

The memory consumed by the process exceeds the size of 306 MB and the
IIS process is recycled, resulting in a "Server Application
Unavailable" error message. The size of the XML result might be 15MB.

The memory of process grows during de Transform method call.

I've already tried use a FileStream to keep memory free but has no
effect.

Any ideas?
Thanks.

Apr 4 '06 #3
Thanks for answer.

How can I debug stylesheet outside of an ASP.NET/IIS application ?

The fonts are below:

The transform code: --------------------------------------

Private Function GetExcelXML(ByRef dts As DataSet, ByVal XSLT As
String) As Stream

Dim xmlDoc As New XPath.XPathDocument(New
StringReader(dts.GetXml))
Dim xslTran As New Xsl.XslTransform
Dim xmlStream As New FileStream(Server.MapPath("buffer.tmp"),
FileMode.Create)
Dim xmlTW As New XmlTextWriter(xmlStream,
System.Text.Encoding.UTF8)

dts = Nothing 'release memory of dataset

xmlTW.Formatting = Formatting.Indented
xmlTW.Indentation = 1
xmlTW.WriteStartDocument()

xslTran.Load(NomeArqXSLT)
xslTran.Transform(xmlDoc, Nothing, xmlTW, Nothing) 'here
the memory increase too much

Return xmlStream
End Function
XSLT file: --------------------------------------

<xsl:stylesheet version="1.0"
xmlns="urn:schemas-microsoft-com:office:spreadsheet"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:msxsl="urn:schemas-microsoft-com:xslt"
xmlns:user="urn:my-scripts"
xmlns:o="urn:schemas-microsoft-com:office:office"
xmlns:x="urn:schemas-microsoft-com:office:excel"
xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet">
<xsl:template match="FloorSpaceDetalhe">
<Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet"
xmlns:o="urn:schemas-microsoft-com:office:office"
xmlns:x="urn:schemas-microsoft-com:office:excel"
xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet"
xmlns:html="http://www.w3.org/TR/REC-html40">
<Styles>
<Style ss:ID="Default" ss:Name="Normal">
<Alignment ss:Vertical="Bottom" />
<Borders />
<Font />
<Interior />
<NumberFormat />
<Protection />
</Style>
<Style ss:ID="s21">
<Font ss:Bold="1" />
<Alignment ss:Horizontal="Center" ss:Vertical="Bottom" />
</Style>
</Styles>
<Worksheet>
<xsl:attribute name="ss:Name">Floor Space Detalhado</xsl:attribute>
<Table>
<Row>
<Cell ss:StyleID="s21">
<Data ss:Type="String">Categoria</Data>
</Cell>
<Cell ss:StyleID="s21">
<Data ss:Type="String">Sub-Categoria</Data>
</Cell>
<Cell ss:StyleID="s21">
<Data ss:Type="String">Capacidade</Data>
</Cell>
<Cell ss:StyleID="s21">
<Data ss:Type="String">Marca</Data>
</Cell>
<Cell ss:StyleID="s21">
<Data ss:Type="String">Modelo</Data>
</Cell>
<Cell ss:StyleID="s21">
<Data ss:Type="String">Data</Data>
</Cell>
<Cell ss:StyleID="s21">
<Data ss:Type="String">Rede</Data>
</Cell>
<Cell ss:StyleID="s21">
<Data ss:Type="String">Cidade</Data>
</Cell>
<Cell ss:StyleID="s21">
<Data ss:Type="String">Estado</Data>
</Cell>
<Cell ss:StyleID="s21">
<Data ss:Type="String">Loja</Data>
</Cell>
<Cell ss:StyleID="s21">
<Data ss:Type="String">Tipo Loja</Data>
</Cell>
<Cell ss:StyleID="s21">
<Data ss:Type="String">Promotor</Data>
</Cell>
<Cell ss:StyleID="s21">
<Data ss:Type="String">Coordenador</Data>
</Cell>
<Cell ss:StyleID="s21">
<Data ss:Type="String">Lojas da Rede</Data>
</Cell>
</Row>
<xsl:apply-templates select="Dados" />
</Table>
</Worksheet>
</Workbook>
</xsl:template>
<xsl:template match="Dados">
<Row>
<Cell>
<Data ss:Type="String">
<xsl:value-of select="dsCategoria" />
</Data>
</Cell>
<Cell>
<Data ss:Type="String">
<xsl:value-of select="dsSubCategoria" />
</Data>
</Cell>
<Cell>
<Data ss:Type="String">
<xsl:value-of select="dsCapacidade" />
</Data>
</Cell>
<Cell>
<Data ss:Type="String">
<xsl:value-of select="dsMarca" />
</Data>
</Cell>
<Cell>
<Data ss:Type="String">
<xsl:value-of select="dsModelo" />
</Data>
</Cell>
<Cell>
<Data ss:Type="String">
<xsl:value-of select="dtFloorSpace" />
</Data>
</Cell>
<Cell>
<Data ss:Type="String">
<xsl:value-of select="dsRede" />
</Data>
</Cell>
<Cell>
<Data ss:Type="String">
<xsl:value-of select="dsCidade" />
</Data>
</Cell>
<Cell>
<Data ss:Type="String">
<xsl:value-of select="cdEstado" />
</Data>
</Cell>
<Cell>
<Data ss:Type="String">
<xsl:value-of select="dsLoja" />
</Data>
</Cell>
<Cell>
<Data ss:Type="String">
<xsl:value-of select="dsTipoLoja" />
</Data>
</Cell>
<Cell>
<Data ss:Type="String">
<xsl:value-of select="dsUsuario" />
</Data>
</Cell>
<Cell>
<Data ss:Type="String">
<xsl:value-of select="dsCoordenador" />
</Data>
</Cell>
<Cell>
<Data ss:Type="Number">
<xsl:value-of select="LojasRede" />
</Data>
</Cell>
</Row>
</xsl:template>
</xsl:stylesheet>
XML Source: --------------------------------------
---->>> In my source, the number of records (Dados) is 23983.

<FloorSpaceDetalhe>
<Dados>
<dsCategoria>Freezer horizontal</dsCategoria>
<dsSubCategoria>Residencial</dsSubCategoria>
<dsCapacidade>De 251 a 350 litros</dsCapacidade>
<dsMarca>Metalfrio</dsMarca>
<dsModelo>DA301</dsModelo>
<dtFloorSpace>16/02/2006</dtFloorSpace>
<dsRede>Ricardo Eletro</dsRede>
<dsCidade>Betim</dsCidade>
<cdEstado>MG</cdEstado>
<dsLoja>8</dsLoja>
<dsTipoLoja>Rua</dsTipoLoja>
<dsUsuario>Andrea Beatriz Maciel </dsUsuario>
<dsCoordenador>Valéria Andrade</dsCoordenador>
<LojasRede>9</LojasRede>
</Dados>
</FloorSpaceDetalhe>

Apr 4 '06 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Kevin Conroy | last post: by
5 posts views Thread by Kevin Westhead | last post: by
reply views Thread by Steve Myers | last post: by
1 post views Thread by manlio | last post: by
4 posts views Thread by Sean Hoffman | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.