[Fwd: Re: [jdom-interest] OutOfMemoryError]

Paul Hunnisett Paul.Hunnisett at uwe.ac.uk
Wed May 10 02:22:47 PDT 2006


It would appear that the memory leak was actually being caused in the 
transform.  Essentially the stylesheet used a helper xml file and used 
document() to pull this in.  It would appear that xalan (2.6) was then 
simply hanging onto references of the dom representing the helper file 
and this caused our leak.

Thanks for all the help.

Cheers

Paul Hunnisett

Paul Hunnisett wrote:
> Yes, I do...
> 
> 
> (You probably want to post this to the list...)
> 
> At 2006-05-09 18:01, Paul Hunnisett wrote:
>> Content-Transfer-Encoding: 8bit
>>
>> OK, I've managed to get a memory profiler running on my code.
>>
>> The first thing I discovered was that in this portlet the 
>> javax.xml.transform.Transformer which was being allocated huge amounts 
>> of memory.  The same object in other portlets was getting much more 
>> sensible levels of memory.
>>
>> I then changed the code so that the xml that was passed into the 
>> transformer was a String.  The portlet was still making a web service 
>> call and was still converting the result to a JDOM.
>>
>> Same result.
>>
>> I then changed the code so that the transform got a string and no web 
>> service call was made - so at no point did I have a dom in memory: 
>> standard or JDOM.  The transformer now has much more sensible levels 
>> of memory.
>>
>> I don;t understand why the transformer should be in anyway affected by 
>> whether there is a dom in memory, but it seems to be.
>>
>> Is anyone able to shed any light on what my next move should be?
>>
>> Cheers
>>
>> Paul Hunnisett
>>
>> Mattias Jiderhamn wrote:
>>> I assume you are talking about JUnit tests. You could execute the 
>>> tests "manually" in a loop. Look at the TestRunner classes in JUnit.
>>> (Though I suppose you could also just do what you do inside the test 
>>> in a loop, unless it depends on dependency injection or something)
>>> At 2006-05-09 12:37, Paul Hunnisett wrote:
>>>> Content-Transfer-Encoding: 8bit
>>>>
>>>> Possibly.  I have unit tests that test the calls to the web service.
>>>> If you know a way of making unit tests run over and over in the same 
>>>> VM then I can do that.  It seems likely to me that the problem is 
>>>> either during the service call or the XSL transform - since that's 
>>>> pretty much all I'm doing. If I can get my unit tests to loop over 
>>>> then I can maybe some kind of idea if it's happening there or the 
>>>> transform...
>>>>
>>>> Cheers
>>>>
>>>> Paul
>>>>
>>>> Mattias Jiderhamn wrote:
>>>>> Can you reproduce the problem outside the container, in a 
>>>>> standalone application?
>>>>> At 2006-05-08 16:23, Paul Hunnisett wrote:
>>>>>> Content-Transfer-Encoding: 8bit
>>>>>>
>>>>>> How do I determine whether it's heap or permgen?  All I get is: 
>>>>>> java.lang.OutOfMemoryError
>>>>>>
>>>>>> I doubt it's an issue with redeploying in tomcat as this is 
>>>>>> something we've done several times a day for the last year and 
>>>>>> it's not like I'm redeploying this often now as the application is 
>>>>>> complete - the only outstanding issue is this memory one...
>>>>>>
>>>>>> It does seem to be a cumulative problem.  I can make about 4 or 5 
>>>>>> soap calls before it falls over...
>>>>>>
>>>>>> Cheers
>>>>>>
>>>>>> Paul
>>>>>>
>>>>>> Mattias Jiderhamn wrote:
>>>>>>> At 2006-05-08 15:39, Paul Hunnisett wrote:
>>>>>>>> I work on a university portal where our channels are developed 
>>>>>>>> as portlets.
>>>>>>>>
>>>>>>>> I recently started a new portlet which would act as a client to 
>>>>>>>> a Web service.  The WS returned a DOM which would then be passed 
>>>>>>>> to an XSL transform.  I decided that this was a good opportunity 
>>>>>>>> to test JDOM in anger and convert the returned DOM in to JDOM 
>>>>>>>> before anything else happens to it.
>>>>>>>>
>>>>>>>> The problem is that after only a little interaction with the 
>>>>>>>> portlet I get an OutOfMemoryError that brings down the whole 
>>>>>>>> portal.  I'm confident that it's JDOM that causes this as we 
>>>>>>>> have several other channels which do the same thing with 
>>>>>>>> standard DOM and cause no such problems.
>>>>>>>>
>>>>>>>> All of the returned documents are small.
>>>>>>>>
>>>>>>>> My initial impression of JDOM is very good, but unless we can 
>>>>>>>> fix this then it's not going to be an option for us.
>>>>>>>>
>>>>>>>> I've already tried increasing the VM memory allocation abd still 
>>>>>>>> get the same problem - as well as grinding my workstation to a 
>>>>>>>> crawl!
>>>>>>> Are you ouf of heap or PermGen?
>>>>>>> What application server are you using? Tomcat has a well known 
>>>>>>> leak of PermGen space when an application is redeployed over and 
>>>>>>> over, which would be the case during development.
>>>>>>>
>>>>>>> This incoming email to UWE has been independently scanned for 
>>>>>>> viruses and any virus detected has been removed using McAfee 
>>>>>>> anti-virus software
>>>>>>
>>>>>>
>>>>>> This email has been independently scanned for viruses and any 
>>>>>> virus software has been removed using McAfee anti-virus software
>>>>>
>>>>> This incoming email to UWE has been independently scanned for 
>>>>> viruses and any virus detected has been removed using McAfee 
>>>>> anti-virus software
>>>>
>>>>
>>>> This email has been independently scanned for viruses and any virus 
>>>> software has been removed using McAfee anti-virus software
>>>
>>> This incoming email to UWE has been independently scanned for viruses 
>>> and any virus detected has been removed using McAfee anti-virus software
>>
>>
>> This email has been independently scanned for viruses and any virus 
>> software has been removed using McAfee anti-virus software
> 
> 
> 
> This incoming email to UWE has been independently scanned for viruses 
> and any virus detected has been removed using McAfee anti-virus software
> 
> 
> 
> This email has been independently scanned for viruses and any virus 
> software has been removed using McAfee anti-virus software
> 
> _______________________________________________
> To control your jdom-interest membership:
> http://www.jdom.org/mailman/options/jdom-interest/youraddr@yourhost.com
> 
> 
> This incoming email to UWE has been independently scanned for viruses 
> and any virus detected has been removed using McAfee anti-virus software
> 


This email has been independently scanned for viruses and any virus software has been removed using McAfee anti-virus software



More information about the jdom-interest mailing list