myfaces-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ravi Kapoor <ravikapoor...@gmail.com>
Subject manually removing page state cache
Date Mon, 07 Jun 2010 07:04:10 GMT
Hello everybody,
I need help with a memory issue.

As we know, trinidad caches page state for each page in memory. Since we are
not using back buttons and do not need to store page state in memory. There
was a defect related to this as well (
https://issues.apache.org/jira/browse/TRINIDAD-1193). However the fix does
not work for me for 2 reasons:

1. We are using trinidad version 1.0.7 (sorry we cannot upgrade due to
corporate cowardliness).
2. I tested with 1.0.10 version and memory is still not freed. I do not know
why. Maybe due to our complicated architecture, trinidad is not able to
correctly identify 'navigate away' event to free up old page state.

After this, I inserted following code before page transition in our
application. This code actually caused a much bigger memory leak rather than
fixing it.

*FacesContext fc = FacesContext.getCurrentInstance();
UIViewRoot vr = fc.getViewRoot();
RenderKit kit = fc.getRenderKit();
ResponseStateManager rsm = kit.getResponseStateManager();
Object token = rsm.getTreeStructureToRestore(fc, vr.getViewId());

TokenCache cache3 = TokenCache.getTokenCacheFromSession(fc,
"org.apache.myfaces.trinidadinternal.application.VIEW_CACHE", false, 1);
cache3.clear(fc.getExternalContext().getSessionMap());

TokenCache tc1 = TokenCache.getTokenCacheFromSession(fc,
"org.apache.myfaces.trinidadinternal.application.VIEW_CACHE", false, 1);
tc1.removeOldEntry((String) token, fc.getExternalContext().getSessionMap())
fc.getExternalContext().getSessionMap().remove("org.apache.myfaces.trinidadinternal.application.VIEW_CACHE."
+ token);
*

Can you help me fix this code so that I can clean up old memory without a
memory leak. Any other ideas area also welcome.

Thanks
Ravi

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message