0

Zkoss Memory Footprint - Best practices in avoiding Memory Leaks?

asked 2010-05-28 05:09:25 +0800

Jon gravatar image Jon
45

updated 2010-05-28 05:16:28 +0800

Hi,

currently our application in production has significant memory problems.
Most of it is ZK - about 64% of Heap space. (See blelow)

Are there best practices for saving memore? We have a Fat RIA, one main page for all.
We use EventThreads. All Composers are also EventListeners which register at the created Components.
No Clustering currently.

Is there any chance to handle a correct cleanup of components from outside?
E.g. if we check that a session is ended to destroy any associated Desktops, Components etc., cleanup any Circular References, etc.?

Should we use a GlobalDesktopCache? What about the components and the composer/Listener in the Desktop? Can they be reused?

Its ZK 3.6.3 at the moment, our next version will be ZK5.

Regards,
Jonas

Package                          Retained Heap                           Retained Heap, %                 # Top Dominators 
<all>                               916.762.104                              100,00%                               1.227.612 </b>
org                                  681.051.936                              74,29%                                 530.979 
zkoss                              627.188.208                              68,41%                                  524.796 
zk                                    373.357.576                                 40,73%                                26.785 
ui                                    365.149.904                              39,83%                                5.526 
impl                                 339.236.872                            37,00%                                 3.055 
DesktopImpl                    236.247.792                          25,77%                                           760 
EventProcessingThreadImpl 98.794.424                       10,78%                                            760 

Total: 2 entries 335.042.216  1.520 

http                                           24.921.584                      2,72%                      1.536 
SimpleWebApp                        24.521.056                      2,67%                      2 
Total: 2 entries 364.158.456  4.591 

zul                                                   195.397.688           21,31%                      411.073 
Textbox                                           44.639.480              4,87%                      31.082 
Window 22.595.072 2,46% 9.097 
Label 15.625.488 1,70% 72.805 
Checkbox 11.618.536 1,27% 6.823 
Row 9.223.352 1,01% 37.901 
Button 9.181.408 1,00% 12.892 
Total: 6 entries 112.883.336  170.600 

zkplus 46.117.640 5,03% 35.640 
databind 46.117.496 5,03% 35.638 
AnnotateDataBinder 38.282.040 4,18% 2.275 
zhtml 9.241.776 1,01% 46.385 
Total: 4 entries 624.114.680  519.883 

apache 51.747.712 5,64% 4.326 
catalina 19.522.288 2,13% 1.796 
connector 11.866.336 1,29% 826 
tomcat 13.458.256 1,47% 350 
util 13.458.256 1,47% 350 
threads 13.383.472 1,46% 207 
ThreadWithAttributes 13.372.904 1,46% 100 
Total: 2 entries 32.980.544  2.146 

Total: 2 entries 678.935.920  529.122 

delete flag offensive retag edit

3 Replies

Sort by ยป oldest newest

answered 2010-06-01 20:54:35 +0800

henrichen gravatar image henrichen
3869 2
ZK Team

If you need to do something whenever the Session is destruct, you can implement a SessionCleanup listener and specify the class in zk.xml.

http://www.zkoss.org/javadoc/5.0/zk/org/zkoss/zk/ui/util/SessionCleanup.html

To use less memory generally means you have to properly arrange your UI pages(Just enough components for the end user to see and input). It is really depends on how you design your application.

And unless you see the memory is not "freed" back to JavaVM, it is not a memory leak.

link publish delete flag offensive edit

answered 2012-03-27 12:23:17 +0800

javaenthu gravatar image javaenthu
141 2

I have similar issue.
I have a tabbed application and on one of the tabs we click we have around 30000 records loaded from the db. Used memory shoots very high.
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?

Pl. guide.

link publish delete flag offensive edit

answered 2012-03-28 00:15:14 +0800

henrichen gravatar image henrichen
3869 2
ZK Team

updated 2012-03-28 00:20:57 +0800

@javaenthu,

How did you load the 30000 records? Into a <listbox> as <listitem> or into a Listmodel? There are some tips to manage huge data in your application. Search "zk huge data" shall give you some hints.

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: 2010-05-28 05:09:25 +0800

Seen: 690 times

Last updated: Mar 28 '12

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