Project

Profile

Help

Memory Issues

Added by Anonymous over 16 years ago

Legacy ID: #4479117 Legacy Poster: tracknerd (tracknerd2003)

I have the following code to build a DynamicQueryContext and it seems to be leaking memory. If I comment out the DocumentInfo info = staticContext.buildDocument(sSource) it stops leaking memory. This is running with version 8.6.1 of saxonB. Each XML file is about 1-2k in size. About every 40k xml files I check the memory and I loose about 1-2k in memory. Any ideas what I could be doing wrong? private DynamicQueryContext buildDynamicContext(String xml) { Configuration config = new Configuration(); StaticQueryContext staticContext = new StaticQueryContext(config); DynamicQueryContext dynamicContext = new DynamicQueryContext(config); StringReader sReader = new StringReader(xml); StreamSource sSource = new StreamSource(sReader); DocumentInfo info = staticContext.buildDocument(sSource); return dynamicContext; }


Replies (3)

Please register to reply

RE: Memory Issues - Added by Anonymous over 16 years ago

Legacy ID: #4479456 Legacy Poster: Michael Kay (mhkay)

There's not much to go on here, unfortunately - the problem is not necessarily in the code you have shown (in fact, there's nothing wrong with that code, so the fault is definitely somewhere else. Using the Heap Analysis Tool (HAT) from Sun can often tell you quite quickly which objects are accumulating in the heap. There have been Saxon memory "leaks" in the past but none for a long time, I'm certainly not aware of any problems in this area. Michael Kay Saxonica

RE: Memory Issues - Added by Anonymous over 16 years ago

Legacy ID: #4480857 Legacy Poster: Michael Kay (mhkay)

A couple of other comments. Firstly, 8.6.1 is now a pretty old release, so when I said there had been no problems recently that might not be relevant; it would be useful to see if you get the same problem with the current release, 8.9.0.4. Secondly, are all your documents using the same XML vocabulary? If not, an increase of 1-2Kb in memory every 40k XML documents could easily be accounted for by more names being added to the NamePool. In 8.9, by default, Saxon allocates a new NamePool for each Configuration, but in earlier releases the default was to use a single static NamePool for everything in the JVM.

RE: Memory Issues - Added by Anonymous over 16 years ago

Legacy ID: #4481911 Legacy Poster: tracknerd (tracknerd2003)

I will give 8.9.0.4 a try. The 40k xml files are the same files over and over again just for testing. Thanks for responding so fast.

    (1-3/3)

    Please register to reply