-
FEATURED COMPONENTS
First time here? Check out the FAQ!
Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=4333543
By: fedd
OutOfMemoryError, setSrc(null)
hi,
it seems to me that when i detach a page by setSrc method in the include element, the page stays somewhere in memory and doesnt get collected. the included zul page has a reference to the desktop and the desktop has multiple reference to my objects, so they are not collected as well.
or - when a page was included programmatically by setSrc() and then the session outdates - the desktop is not gc-ed.
anyway, at the end i get OutOfMemoryError.
nowhere in my code i have references to any of zk object, except in the codes which extend Window and other elements.
please give a hint could it be so and what should i do...
fedd
Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=4334117
By: jumperchen
Could you provide some example about your issue?
Thanks,
Jumper
Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=4334315
By: fedd
it's very difficult because the application has grown very big; can't provide a purified example.
but i wrote a little program that walks on references of loaded objects; here are all the references it found to desktops. note that the DesktopImpl(id=3306) is not used for nore than 10 minutes (desktop timeout is set to 2 mins, session timeout - 2 minutes). see, there are only references from pages and PageImpl$NS objects, no references to desktops from my objects!
org.zkoss.zk.ui.impl.DesktopImpl: 2 insts
---- inst: instance of org.zkoss.zk.ui.impl.DesktopImpl(id=3306): 32 refs
---- ---- ref: instance of org.zkoss.zk.ui.impl.PageImpl(id=3616)---- name:
"call_zul"
---- ---- ref: instance of org.zkoss.zk.ui.impl.PageImpl(id=3617)---- name:
"historyActionsListPage"
---- ---- ref: instance of org.zkoss.zk.ui.impl.PageImpl(id=3618)---- name:
"dcaselistpage"
---- ---- ref: instance of org.zkoss.zk.ui.impl.PageImpl(id=3619)---- name:
"z__p0"
---- ---- ref: instance of org.zkoss.zk.ui.impl.PageImpl(id=3620)---- name:
"resultListPage"
---- ---- ref: instance of org.zkoss.zk.ui.impl.PageImpl(id=3621)---- name:
"dataset_zul"
---- ---- ref: instance of java.util.HashMap$Entry(id=3622)
---- ---- ---- in: instance of org.zkoss.zk.ui.impl.PageImpl$NS(id=3503) thru:
instance of java.util.HashMap$Entry[16] (id=3501)-instance of
java.util.HashMap(id=3502)-
---- ---- ref: instance of org.zkoss.zk.ui.impl.PageImpl(id=3623)---- name:
"menuPage"
---- ---- ref: instance of org.zkoss.zk.ui.impl.PageImpl(id=3624)---- name:
"z__p1"
---- ---- ref: instance of java.util.HashMap$Entry(id=3625)
---- ---- ---- in: instance of org.zkoss.zk.ui.impl.PageImpl$NS(id=3511) thru:
instance of java.util.HashMap$Entry[16] (id=3509)-instance of
java.util.HashMap(id=3510)-
---- ---- ref: instance of java.util.HashMap$Entry(id=3626)
---- ---- ---- in: instance of org.zkoss.zk.ui.impl.PageImpl$NS(id=3514) thru:
instance of java.util.HashMap$Entry[16] (id=3512)-instance of
java.util.HashMap(id=3513)-
---- ---- ref: instance of java.util.HashMap$Entry(id=3627)
---- ---- ---- in: instance of org.zkoss.zk.ui.impl.PageImpl$NS(id=3517) thru:
instance of java.util.HashMap$Entry[16] (id=3515)-instance of
java.util.HashMap(id=3516)-
---- ---- ref: instance of org.zkoss.zk.ui.impl.PageImpl(id=3628)---- name:
"plannedActionsListPage"
---- ---- ref: instance of org.zkoss.zk.ui.impl.PageImpl(id=3629)---- name:
"z__p4"
---- ---- ref: instance of org.zkoss.zk.ui.impl.PageImpl(id=3630)---- name:
"promise_zul"
---- ---- ref: instance of org.zkoss.zk.ui.impl.PageImpl(id=3631)---- name:
"main"
---- ---- ref: instance of java.util.HashMap$Entry(id=3632)
---- ---- ---- in: instance of org.zkoss.zk.ui.impl.PageImpl$NS(id=3538) thru:
instance of java.util.HashMap$Entry[16] (id=3536)-instance of
java.util.HashMap(id=3537)-
---- ---- ref: instance of java.util.HashMap$Entry(id=3633)
---- ---- ---- in: instance of org.zkoss.zk.ui.impl.PageImpl$NS(id=3520) thru:
instance of java.util.HashMap$Entry[16] (id=3518)-instance of
java.util.HashMap(id=3519)-
---- ---- ref: instance of java.util.HashMap$Entry(id=3634)
---- ---- ---- in: instance of org.zkoss.zk.ui.impl.PageImpl$NS(id=3523) thru:
instance of java.util.HashMap$Entry[16] (id=3521)-instance of
java.util.HashMap(id=3522)-
---- ---- ref: instance of java.util.HashMap$Entry(id=3635)
---- ---- ---- in: instance of org.zkoss.zk.ui.impl.PageImpl$NS(id=3526) thru:
instance of java.util.HashMap$Entry[16] (id=3524)-instance of
java.util.HashMap(id=3525)-
---- ---- ref: instance of org.zkoss.zk.ui.impl.PageImpl(id=3636)---- name:
"z__p2"
---- ---- ref: instance of java.util.HashMap$Entry(id=3637)
---- ---- ---- in: instance of org.zkoss.zk.ui.impl.PageImpl$NS(id=3542) thru:
instance of java.util.HashMap$Entry[32] (id=3540)-instance of
java.util.HashMap(id=3541)-
---- ---- ref: instance of java.util.HashMap$Entry(id=3638)
---- ---- ---- in: instance of org.zkoss.zk.ui.impl.PageImpl$NS(id=3529) thru:
instance of java.util.HashMap$Entry[16] (id=3527)-instance of
java.util.HashMap(id=3528)-
---- ---- ref: instance of org.zkoss.zk.ui.impl.PageImpl(id=3639)---- name:
"z__p3"
---- ---- ref: instance of java.util.HashMap$Entry(id=3640)
---- ---- ---- in: instance of org.zkoss.zk.ui.impl.PageImpl$NS(id=3500) thru:
instance of java.util.HashMap$Entry(id=3662)-instance of java.util.HashMap$Entry[16] (id=3498)-instance of java.util.HashMap(id=3499)-
---- ---- ref: instance of java.util.HashMap$Entry(id=3641)
---- ---- ---- in: instance of org.zkoss.zk.ui.impl.PageImpl$NS(id=3545) thru:
instance of java.util.HashMap$Entry[16] (id=3543)-instance of
java.util.HashMap(id=3544)-
---- ---- ref: instance of java.util.HashMap$Entry(id=3642)
---- ---- ---- in: instance of org.zkoss.zk.ui.impl.PageImpl$NS(id=3548) thru:
instance of java.util.HashMap$Entry[16] (id=3546)-instance of
java.util.HashMap(id=3547)-
---- ---- ref: instance of java.util.HashMap$Entry(id=3643)
---- ---- ---- in: instance of org.zkoss.zk.ui.impl.PageImpl$NS(id=3534) thru:
instance of java.util.HashMap$Entry[32] (id=3531)-instance of
java.util.HashMap(id=3532)-
---- ---- ---- in: instance of java.util.HashMap$KeySet(id=3533) thru: instance of java.util.HashMap$Entry[32] (id=3531)-instance of java.util.HashMap(id=3532)-
---- ---- ref: instance of org.zkoss.zk.ui.impl.PageImpl(id=3644)---- name:
"dcasepage"
---- ---- ref: instance of java.util.HashMap$Entry(id=3645)
---- ---- ---- in: instance of org.zkoss.zk.ui.impl.PageImpl$NS(id=3507) thru:
instance of java.util.HashMap$Entry[32] (id=3505)-instance of
java.util.HashMap(id=3506)-
---- ---- ---- in: instance of java.util.HashMap$KeySet(id=3508) thru: instance of java.util.HashMap$Entry[32] (id=3505)-instance of java.util.HashMap(id=3506)-
---- ---- ref: instance of org.zkoss.zk.ui.impl.PageImpl(id=3646)---- name:
"loginPage"
---- ---- ref: instance of java.util.HashMap$Entry(id=3647)
---- ---- ---- in: instance of org.zkoss.zk.ui.impl.PageImpl$NS(id=3551) thru:
instance of java.util.HashMap$Entry[16] (id=3549)-instance of
java.util.HashMap(id=3550)-
---- inst: instance of org.zkoss.zk.ui.impl.DesktopImpl(id=3556): 30 refs
---- ---- ref: instance of java.util.HashMap$Entry(id=3665)
---- ---- ---- in: instance of org.zkoss.zk.ui.impl.PageImpl$NS(id=3582) thru:
instance of java.util.HashMap$Entry(id=3695)-instance of java.util.HashMap$Entry[16] (id=3580)-instance of java.util.HashMap(id=3581)-
---- ---- ref: instance of java.util.HashMap$Entry(id=3666)
---- ---- ---- in: instance of org.zkoss.zk.ui.impl.PageImpl$NS(id=3572) thru:
instance of java.util.HashMap$Entry[32] (id=3570)-instance of
java.util.HashMap(id=3571)-
---- ---- ---- in: instance of java.util.HashMap$KeySet(id=3573) thru: instance of java.util.HashMap$Entry[32] (id=3570)-instance of java.util.HashMap(id=3571)-
---- ---- ref: instance of java.util.HashMap$Entry(id=3667)
---- ---- ---- in: instance of org.zkoss.zk.ui.impl.UiEngineImpl(id=3698) thru:
instance of java.util.HashMap$Entry[16] (id=3696)-instance of
java.util.HashMap(id=3697)-
---- ---- ref: instance of org.zkoss.zk.ui.impl.PageImpl(id=3668)---- name:
"z__ps1"
---- ---- ref: instance of org.zkoss.zk.ui.impl.PageImpl(id=3669)---- name:
"z__pu1"
---- ---- ref: instance of org.zkoss.zk.ui.impl.PageImpl(id=3670)---- name:
"historyActionsListPage"
---- ---- ref: instance of java.util.HashMap$Entry(id=3671)
---- ---- ---- in: instance of org.zkoss.zk.ui.impl.PageImpl$NS(id=3576) thru:
instance of java.util.HashMap$Entry[16] (id=3574)-instance of
java.util.HashMap(id=3575)-
---- ---- ref: instance of java.util.HashMap$Entry(id=3672)
---- ---- ---- in: instance of org.zkoss.zk.ui.impl.PageImpl$NS(id=3579) thru:
instance of java.util.HashMap$Entry[16] (id=3577)-instance of
java.util.HashMap(id=3578)-
---- ---- ref: instance of org.zkoss.zk.ui.impl.PageImpl(id=3673)---- name:
"dcasepage"
---- ---- ref: instance of java.util.HashMap$Entry(id=3674)
---- ---- ---- in: instance of org.zkoss.zk.ui.impl.PageImpl$NS(id=3615) thru:
instance of java.util.HashMap$Entry(id=3701)-instance of java.util.HashMap$Entry[16] (id=3613)-instance of java.util.HashMap(id=3614)-
---- ---- ref: instance of org.zkoss.util.CacheMap$Value(id=3675)
---- ---- ref: instance of org.zkoss.zk.ui.impl.PageImpl(id=3676)---- name:
"main"
---- ---- ref: instance of java.util.HashMap$Entry(id=3677)
---- ---- ---- in: instance of java.util.HashMap$KeySet(id=3586) thru: instance of java.util.HashMap$Entry[32] (id=3584)-instance of java.util.HashMap(id=3585)-
---- ---- ---- in: instance of org.zkoss.zk.ui.impl.PageImpl$NS(id=3587) thru:
instance of java.util.HashMap$Entry[32] (id=3584)-instance of
java.util.HashMap(id=3585)-
---- ---- ref: instance of org.zkoss.zk.ui.impl.PageImpl(id=3678)---- name:
"searchBoxPage"
---- ---- ref: instance of java.util.HashMap$Entry(id=3679)
---- ---- ---- in: instance of org.zkoss.zk.ui.impl.PageImpl$NS(id=3590) thru:
instance of java.util.HashMap$Entry[16] (id=3588)-instance of
java.util.HashMap(id=3589)-
---- ---- ref: instance of org.zkoss.zk.ui.impl.PageImpl(id=3680)---- name:
"plannedActionsListPage"
---- ---- ref: instance of org.zkoss.zk.ui.impl.PageImpl(id=3681)---- name:
"foundListPage"
---- ---- ref: instance of java.util.HashMap$Entry(id=3682)
---- ---- ---- in: instance of org.zkoss.zk.ui.impl.PageImpl$NS(id=3593) thru:
instance of java.util.HashMap$Entry[16] (id=3591)-instance of
java.util.HashMap(id=3592)-
---- ---- ref: instance of java.util.HashMap$Entry(id=3683)
---- ---- ---- in: instance of org.zkoss.zk.ui.impl.PageImpl$NS(id=3596) thru:
instance of java.util.HashMap$Entry[16] (id=3594)-instance of
java.util.HashMap(id=3595)-
---- ---- ref: instance of org.zkoss.zk.ui.impl.PageImpl(id=3684)---- name:
"z__pv1"
---- ---- ref: instance of org.zkoss.zk.ui.impl.PageImpl(id=3685)---- name:
"z__p02"
---- ---- ref: instance of org.zkoss.zk.ui.impl.PageImpl(id=3686)---- name:
"menuPage"
---- ---- ref: instance of java.util.HashMap$Entry(id=3687)
---- ---- ---- in: instance of org.zkoss.zk.ui.impl.PageImpl$NS(id=3599) thru:
instance of java.util.HashMap$Entry[16] (id=3597)-instance of
java.util.HashMap(id=3598)-
---- ---- ref: instance of java.util.HashMap$Entry(id=3688)
---- ---- ---- in: instance of org.zkoss.zk.ui.impl.PageImpl$NS(id=3602) thru:
instance of java.util.HashMap$Entry[16] (id=3600)-instance of
java.util.HashMap(id=3601)-
---- ---- ref: instance of java.util.HashMap$Entry(id=3689)
---- ---- ---- in: instance of org.zkoss.zk.ui.impl.PageImpl$NS(id=3606) thru:
instance of java.util.HashMap$Entry[16] (id=3604)-instance of
java.util.HashMap(id=3605)-
---- ---- ref: instance of org.zkoss.zk.ui.impl.PageImpl(id=3690)---- name:
"promise_zul"
---- ---- ref: instance of java.util.HashMap$Entry(id=3691)
---- ---- ---- in: instance of org.zkoss.zk.ui.impl.PageImpl$NS(id=3609) thru:
instance of java.util.HashMap$Entry[16] (id=3607)-instance of
java.util.HashMap(id=3608)-
---- ---- ref: instance of org.zkoss.zk.ui.impl.PageImpl(id=3692)---- name:
"z__pt1"
---- ---- ref: instance of org.zkoss.zk.ui.impl.PageImpl(id=3693)---- name:
"resultListPage"
---- ---- ref: instance of java.util.HashMap$Entry(id=3694)
---- ---- ---- in: instance of org.zkoss.zk.ui.impl.PageImpl$NS(id=3612) thru:
instance of java.util.HashMap$Entry[16] (id=3610)-instance of
java.util.HashMap(id=3611)-
Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=4334509
By: jumperchen
Could you provide your a little program that it can test for us?
Thanks a lot,
Jumper
Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=4334592
By: fedd
Jumper,
yes, for example, try these three little pages
leaktestMain.zul
<?xml version="1.0" encoding="windows-1251"?> <?page id="leakTestPage" title="Leak Test"?>
<window id="leakTestWindow">
<button label="Switch includes"
onClick="if(includePlace.getSrc().equals("leaktest1.zul"))
includePlace.setSrc("leaktest2.zul"); else includePlace.setSrc("leaktest1.zul"); "/>
<include id="includePlace" src="leaktest1.zul"/>
</window>
leaktest1.zul
<?xml version="1.0" encoding="windows-1251"?> <?page id="leakTest1" title="Leak Test Include"?>
<window id="leakTestInclude">
<hbox forEach="${desktopScope.stringArray}">${each}</hbox>
<button if="${empty desktopScope.stringArray}" label="Populate Array"
onClick="desktopScope.put("stringArray", new String[]{"one", "two", "three"})"/>
</window>
leaktest2.zul
<?xml version="1.0" encoding="windows-1251"?> <?page id="leakTest2" title="Leak Test Include 2"?>
<window id="leakTestInclude">
Here is nothing
</window>
set the desktop and session timeout for 2 minutes
go to leaktestMain.zul, press the button "Switch includes" several times, then populate the array by the button on the first include, then switch includes again.
open in several browser windows; close them in any order.
i have one desktop implementation instance living in memory forever together with the array that was filled by "Populate array" button.
i think that the array and desktop stay in memory when you close the browser while "leaktest2.zul" is included.
fedd
Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=4334753
By: gback
Did you try using jmat/jhat?
See http://sourceforge.net/forum/message.php?msg_id=4279633
Does this happen during development when you reload changed classes, or do you have context reloadable turned off in your Tomcat settings?
Beanshell is known to cache defined classes, see
http://sourceforge.net/forum/message.php?msg_id=3869487
I tried to get some answers from the ZK developers on what component caching strategy they use here: http://sourceforge.net/forum/message.php?msg_id=4314709
but no answer so far.
Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=4334783
By: fedd
> Did you try using jmat/jhat?
no, i used my own little program, that used this
http://java.sun.com/javase/6/docs/jdk/api/jpda/jdi/com/sun/jdi/ObjectReference.h
tml#referringObjects(long)
this happens during both development and production using. the reloadable is not switched off but i never upload new classes to the system while tomcat's running
i dont think that this is a beanshell issue because in my real case the array is put to the desktop attribute hashmap by java method in the class that extends zk's window but not by zscript
i've read your and some other's posts and also thought about their cache. i thought they use weak references in their cache so that when the desktopn is unused it could get garbage collected... but i have no strong references...
Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=4336478
By: fedd
the continuation:
http://sourceforge.net/forum/message.php?msg_id=4336472
Hi Alassane,
Which issue do you have? OutOfMemoryError?
And do you have a test case?
/robbie
Asked: 2007-05-28 15:16:53 +0800
Seen: 164 times
Last updated: Jan 19 '09