0

Facing a memory leak

asked 2012-03-27 08:34:34 +0800

javaenthu gravatar image javaenthu
141 2

updated 2012-03-27 08:37:45 +0800

Hi ,
in my j2ee application I am facing issue with memory leak.
I did profiling of the project and it seems its the issue with ZK or our usage of ZK.

I see lot of Hashmap and Map.Entry objects in the heap. (261 MB)
Around 232MB of int[] and 129 MB of char[].

We have a smile application with tabs.

On the select of the tab we are attaching the source.

if (inc.getSrc() == null) {
					inc.setSrc("/zul/1.zul");
				} else {
					 MyComposer myComposer = (MyComposer) tabBox.getAttribute("myComposer");
					 myComposer.refeshList();
				}

And in the composer classes we have different methods which are dealing with dbs.
I am on tab1 and then going to tab2, ....tabN. Memory usage is going heigher and heigher. I am not sure what's the issue here.

In our composer classes we have overridden a method :

@Override
    public void doAfterCompose(Component comp)  {
        super.doAfterCompose(comp);
         Component tabBoxComponent = comp.getParent().getParent().getParent().getParent();
         tabBoxComponent.setAttribute("myComposer", this);
    }

Can any one suggest what is the issue?

delete flag offensive retag edit

4 Replies

Sort by ยป oldest newest

answered 2012-03-27 12:15:07 +0800

javaenthu gravatar image javaenthu
141 2

updated 2012-03-27 13:01:12 +0800

And i go on various tabs, do various operations (not on this tab) but still up gone memory doesn't come down.
Can any one suggest what might be the issue?
Do we need to reclaim the memory used by ZKoss periodically?

Please feel free to ask if something is not clear.

I have attached 2 snaps shots. I am seeing lot of Hasmpa entries are getting created. Hashap and I have taken mark of the memory and the data about the existing objects is here.

link publish delete flag offensive edit

answered 2012-03-28 09:45:24 +0800

terrytornado gravatar image terrytornado flag of Germany
9393 3 7 16
http://www.oxitec.de/

Hmmm, i'm not sure about how you deal with tab+composer.

tabBox.getAttribute("myComposer");

Does every tab is controlled by the same ONE composer?

link publish delete flag offensive edit

answered 2012-03-28 10:09:33 +0800

dennis gravatar image dennis
3669 1 6
http://www.javaworld.com....

there are many reason that memory is not released.
If I were you , I will try to detach some UI after the memory grow up (add a button to detach tabbox or each tab for test). then check if the memory again.
repeat it on the parent if the memory(objects) still not released.
if the memory was released, you could check you app if it store anything in component attribute
if not, try to remove the desktop,(by close the tab in firefox), check the memory again, then check if any thing you store in desktop attribute.
if not, then try to clear the session(set session timeout shorter), check the memory again after the session was timeout ...

link publish delete flag offensive edit

answered 2012-03-28 10:51:27 +0800

javaenthu gravatar image javaenthu
141 2

@Terry, thanks.
We are having different composer for different tabs.

link publish delete flag offensive edit
Your reply
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow

RSS

Stats

Asked: 2012-03-27 08:34:34 +0800

Seen: 249 times

Last updated: Mar 28 '12

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More