On 23/07/10 10:19, Johan Compagner wrote:
> i think the problem with those memory analyzers that they give you the heap
> Not the non heap, which is currently the problem..

Yes, but they are the only thing you have if you do not use a profiler
to look at the running app.

And since the permanent generation does not grow on it's own without any
link to the heap, you can find the reason for the problem this way with
a little luck.

> If really constantly classes are leaked without that you constantly
> redeploy web applications (because that would be a leak somewhere in
> wicket or the app itself)

It can be a problem in any library that you use and that are generally
quite many these days...
I had similar problems with database drivers and object mapping libs,
but you are right, in this case the problem normally arises with
redeployments of the app without restart of the container.

http://dev.eclipse.org/blogs/memoryanalyzer/2008/05/17/the-unknown-generation-perm/

> but the only thing you do is serializing these kind of objects:

You may be right with your analysis of the serialization, I just want to
note here that in case of an out of memory error the stack trace can be
completely irrelevant. It just shows at what step the memory was full,
but that step does not have to be the cause for the memory filling up.

> // not serializeable and doesnt have a default constructor
> public class A  {
>     String name;
> 
>     // add this constructor so the compiler doesnt generate a default one.
>     public A(String name)   {
>            this.name = name;
>     }
> }
> 
> public class B extends A implements Serializable {
>         int aNumber;
>         public B() {
>               super("B");
>              aNumber = 10;
>         }
>  }
> 
> If you then serialize instances of B then i think you will come into
> the section of the stacktrace James gave.
> 
> But this shouldnt really leak into the none heap. (and result in an
> never ending grow) that would just a bug in java itself if you ask me.
> i think the work around is to give the A class a private constructor:
> 
> private A() {}
> 
> Then i think nothing is tried to be generated.
> 
> 
> 2010/7/23 Andreas Prieß <[email protected]>:
>> On 22/07/10 21:53, James Carman wrote:
>>> I'm running Tomcat, so it's:
>>>
>>> $ env | grep CATALINA
>>> CATALINA_OPTS= -Xmx4096m -Xms2048m -XX:MaxPermSize=1024m
>>> -XX:+UseParallelGC -server
>>
>> Well, if you have increased memory for the permanent generation several
>> times and keep seeing this error, for me this sounds like a memory leak.
>>
>> Tuning the java garbage collection will in all cases not help here,
>> because java only throws an out of memory error if garbage collection
>> does not help any more.
>>
>> I would enable the following for tomcat:
>> -XX:+HeapDumpOnOutOfMemoryError
>> -XX:HeapDumpPath=/var/log/java/whatever
>>
>> Then you can analyse what holds all the memory after the next crash.
>>
>> A nice tool for that is the Eclipse Memory Analyzer:
>> http://www.eclipse.org/mat/
>>
>> A little how to for getting started:
>> http://wiki.eclipse.org/index.php/MemoryAnalyzer
>>
>> And you should search what they have at the tomcat pages and on their
>> mailing list archives:
>> http://wiki.apache.org/tomcat/OutOfMemory
>>
>> This is most likely not specific to wicket itself.
>>
>>
>> Andreas

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to