You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Tomek Szpinda <ts...@gmail.com> on 2007/05/11 16:35:25 UTC

t:schedule - out of memory

Hi!
    I'm having a problem with the t:schedule(I think) component.
It appears when I display about 100 events on the screen then logout, 
login again, then display again  100 appointments,  I get:

    java.lang.OutOfMemoryError: Java heap space

It looks to me(probably I'm wrong:)) that Tomcat doesn't release memory 
after session.invalidate()?

If any one can give me some hints I'd be thankful.

Best Regards,

Tomek


Full exception:

java.lang.OutOfMemoryError: Java heap space
    at java.util.Arrays.copyOf(Arrays.java:2882)
    at 
java.lang.AbstractStringBuilder.expandCapacity(AbstractStringBuilder.java:100)
    at 
java.lang.AbstractStringBuilder.append(AbstractStringBuilder.java:572)
    at java.lang.StringBuffer.append(StringBuffer.java:320)
    at org.apache.log4j.NDC$DiagnosticContext.<init>(NDC.java:426)
    at org.apache.log4j.NDC.push(NDC.java:350)
    at com.ylem.knowledge.logger.Log.add(Log.java:18)
    at com.ylem.knowledge.connection.DBWrapper.doQuery(DBWrapper.java:109)
    at 
com.ylem.knowledge.diary.AbstractMultiThing.getThingCodeListByDiaryKey(AbstractMultiThing.java:129)
    at 
com.ylem.knowledge.diary.KnowledgeScheduleEntry.getEntryById(KnowledgeScheduleEntry.java:120)
    at 
com.ylem.knowledge.diary.KnowledgeScheduleModel.loadEntries(KnowledgeScheduleModel.java:129)
    at 
org.apache.myfaces.custom.schedule.model.AbstractScheduleModel.load(AbstractScheduleModel.java:464)
    at 
org.apache.myfaces.custom.schedule.model.AbstractScheduleModel.setMonth(AbstractScheduleModel.java:296)
    at 
org.apache.myfaces.custom.schedule.model.AbstractScheduleModel.setSelectedDate(AbstractScheduleModel.java:136)
    at com.ylem.knowledge.diary.ViewSchedule.<init>(ViewSchedule.java:44)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at 
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
    at 
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
    at java.lang.Class.newInstance0(Class.java:355)
    at java.lang.Class.newInstance(Class.java:308)
    at 
org.apache.myfaces.shared_impl.util.ClassUtils.newInstance(ClassUtils.java:277)
    at 
org.apache.myfaces.shared_impl.util.ClassUtils.newInstance(ClassUtils.java:268)
    at 
org.apache.myfaces.config.ManagedBeanBuilder.buildManagedBean(ManagedBeanBuilder.java:49)
    at 
org.apache.myfaces.el.VariableResolverImpl.resolveVariable(VariableResolverImpl.java:314)
    at 
org.apache.myfaces.custom.redirectTracker.RedirectTrackerVariableResolver.resolveVariable(RedirectTrackerVariableResolver.java:41)
    at 
org.apache.myfaces.custom.security.SecurityContextVariableResolver.resolveVariable(SecurityContextVariableResolver.java:45)
    at 
org.apache.myfaces.el.ValueBindingImpl$ELVariableResolver.resolveVariable(ValueBindingImpl.java:570)
    at org.apache.commons.el.NamedValue.evaluate(NamedValue.java:124)
    at org.apache.commons.el.ComplexValue.evaluate(ComplexValue.java:140)
    at 
org.apache.myfaces.el.ValueBindingImpl.getValue(ValueBindingImpl.java:386)
    at 
org.apache.myfaces.application.ApplicationImpl.createComponent(ApplicationImpl.java:427)


Re: t:schedule - out of memory

Posted by Tomek Szpinda <ts...@gmail.com>.
I've seen it, but couldn't make it working.
Anyway I sorted out the leak memory problem using the Netbeans Profiler 
which is actually quite nice.

Thanks for help!

Tomek

Glauco Pimentel Gomes wrote:
> In Eclipse you could use the "Eclipse Test & Performance Tools 
> Platform Project" [1] to profile.
>
> [1]  http://www.eclipse.org/tptp/
>
> Glauco P. Gomes
>
>
> Tomek Szpinda escreveu:
>> Thorbjørn Ravn Andersen wrote:
>>> Tomek Szpinda skrev  den 11-05-2007 16:35:
>>>>
>>>>    java.lang.OutOfMemoryError: Java heap space
>>>>
>>>> It looks to me(probably I'm wrong:)) that Tomcat doesn't release 
>>>> memory after session.invalidate()?
>>>>
>>> You need to ensure yourself that your objects can be garbage 
>>> collected by removing all the reference you have to them.
>>>
>>>> If any one can give me some hints I'd be thankful.
>>>>
>>>> Best Regards,
>>>
>>>>    at java.lang.StringBuffer.append(StringBuffer.java:320)
>>>>    at org.apache.log4j.NDC$DiagnosticContext.<init>(NDC.java:426)
>>>>    at org.apache.log4j.NDC.push(NDC.java:350)
>>>>    at com.ylem.knowledge.logger.Log.add(Log.java:18)
>>>>
>>>
>>> A guess could be that this module does not properly release its 
>>> log4j NDC-objects after use.
>>>
>>> This might be a good time to learn and use the profiler i.e. in 
>>> Netbeans.
>>>
>>
>> I tried to find something for eclipse, but that's not so easy...
>> Eclipse Test and Performance Tools Platform 
>> <http://www.eclipse.org/tptp/>
>> So first need to learn Netbeans... ;) but learning is never bad 
>> thing, so better I'll start now.
>>
>> Thanks,
>>
>> Tomek
>>
>
>


Re: t:schedule - out of memory

Posted by Glauco Pimentel Gomes <gl...@yahoo.com.br>.
In Eclipse you could use the "Eclipse Test & Performance Tools Platform 
Project" [1] to profile.

[1]  http://www.eclipse.org/tptp/

Glauco P. Gomes


Tomek Szpinda escreveu:
> Thorbjørn Ravn Andersen wrote:
>> Tomek Szpinda skrev  den 11-05-2007 16:35:
>>>
>>>    java.lang.OutOfMemoryError: Java heap space
>>>
>>> It looks to me(probably I'm wrong:)) that Tomcat doesn't release 
>>> memory after session.invalidate()?
>>>
>> You need to ensure yourself that your objects can be garbage 
>> collected by removing all the reference you have to them.
>>
>>> If any one can give me some hints I'd be thankful.
>>>
>>> Best Regards,
>>
>>>    at java.lang.StringBuffer.append(StringBuffer.java:320)
>>>    at org.apache.log4j.NDC$DiagnosticContext.<init>(NDC.java:426)
>>>    at org.apache.log4j.NDC.push(NDC.java:350)
>>>    at com.ylem.knowledge.logger.Log.add(Log.java:18)
>>>
>>
>> A guess could be that this module does not properly release its log4j 
>> NDC-objects after use.
>>
>> This might be a good time to learn and use the profiler i.e. in 
>> Netbeans.
>>
>
> I tried to find something for eclipse, but that's not so easy...
> Eclipse Test and Performance Tools Platform <http://www.eclipse.org/tptp/>
> So first need to learn Netbeans... ;) but learning is never bad thing, 
> so better I'll start now.
>
> Thanks,
>
> Tomek
>


Re: t:schedule - out of memory

Posted by Tomek Szpinda <ts...@gmail.com>.
Thorbjørn Ravn Andersen wrote:
> Tomek Szpinda skrev  den 11-05-2007 16:35:
>>
>>    java.lang.OutOfMemoryError: Java heap space
>>
>> It looks to me(probably I'm wrong:)) that Tomcat doesn't release 
>> memory after session.invalidate()?
>>
> You need to ensure yourself that your objects can be garbage collected 
> by removing all the reference you have to them.
>
>> If any one can give me some hints I'd be thankful.
>>
>> Best Regards,
>
>>    at java.lang.StringBuffer.append(StringBuffer.java:320)
>>    at org.apache.log4j.NDC$DiagnosticContext.<init>(NDC.java:426)
>>    at org.apache.log4j.NDC.push(NDC.java:350)
>>    at com.ylem.knowledge.logger.Log.add(Log.java:18)
>>
>
> A guess could be that this module does not properly release its log4j 
> NDC-objects after use.
>
> This might be a good time to learn and use the profiler i.e. in Netbeans.
>

I tried to find something for eclipse, but that's not so easy...

So first need to learn Netbeans... ;) but learning is never bad thing, 
so better I'll start now.

Thanks,

Tomek

Re: t:schedule - out of memory

Posted by Thorbjørn Ravn Andersen <th...@gmail.com>.
Tomek Szpinda skrev  den 11-05-2007 16:35:
>
>    java.lang.OutOfMemoryError: Java heap space
>
> It looks to me(probably I'm wrong:)) that Tomcat doesn't release 
> memory after session.invalidate()?
>
You need to ensure yourself that your objects can be garbage collected 
by removing all the reference you have to them.

> If any one can give me some hints I'd be thankful.
>
> Best Regards,

>    at java.lang.StringBuffer.append(StringBuffer.java:320)
>    at org.apache.log4j.NDC$DiagnosticContext.<init>(NDC.java:426)
>    at org.apache.log4j.NDC.push(NDC.java:350)
>    at com.ylem.knowledge.logger.Log.add(Log.java:18)
>

A guess could be that this module does not properly release its log4j 
NDC-objects after use.

This might be a good time to learn and use the profiler i.e. in Netbeans.

-- 
  Thorbjørn