Memory Leak - HE

  • Hello

    In a VS.NET 2010 C# app that transforms a huge amount of files, after
    approximatively 1000/1005 transformations I have the following error on a 2GB
    machine :

    Message "Une exception de type 'System.OutOfMemoryException' a été levée."
    Source "saxon9he" string
    StackTrace " à
    org.apache.xerces.parsers.XML11Configuration.parse(XMLInputSource xmlis)\r\n à
    org.apache.xerces.parsers.XMLParser.parse(XMLInputSource xmlis)\r\n à
    org.apache.xerces.parsers.AbstractSAXParser.parse(InputSource is)\r\n à
    org.apache.xerces.jaxp.SAXParserImpl.JAXPSAXParser.parse(InputSource is)\r\n à
    net.sf.saxon.event.Sender.sendSAXSource(SAXSource , Receiver , ParseOptions
    )\r\n à net.sf.saxon.event.Sender.send(Source source, Receiver receiver,
    ParseOptions options)\r\n à net.sf.saxon.Configuration.buildDocument(Source
    source, ParseOptions parseOptions)\r\n à
    net.sf.saxon.Configuration.buildDocument(Source source)\r\n à
    Saxon.Api.DocumentBuilder.Build(Stream input, Uri baseUri)\r\n à
    Saxon.Api.DocumentBuilder.Build(Uri uri)\r\n à
    SAXONTEST.Program.TransformSaxon(String InFilePath, String XslFilePath, String
    outPath, String outFile) dans C:\_TESTAPP\SAXONTEST\Program.cs:ligne 49\r\n
    à SAXONTEST.Program.Main(String args) dans
    C:\_TESTAPP\SAXONTEST\Program.cs:ligne 280" string

    Any help would be appreciated if possible :)

    Thanks !!!

  • Michael Kay
    Michael Kay

    You'll need to provide a bit more information. Are you running lots of
    separate transformations each on one file, or a single transformation that
    reads lots of files using the doc() or collection() functions? It's likely
    that the documents are being cached somewhere and that you need to clear the
    cache, but exactly how to achieve this depends on the details of the workload.

    It's not a memory leak, by the way. It's just using more memory than you have

  • Sorry it is now resolved !

    Before I was doing :
    if (transformer == null) transformer = processor.NewXsltCompiler().Compile(new

    Resolved by :
    transformer = processor.NewXsltCompiler().Compile(new

    :) is a really powerful solution.

  • mhkay, you are right. this is not a memory leak.

    this was a problem in my code. Now resolved as I wrote previously.

    Thanks anyway for the really quick answer :) :) :)