[ 
https://issues.apache.org/jira/browse/MYFACES-4563?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17689204#comment-17689204
 ] 

Volodymyr Siedlecki commented on MYFACES-4563:
----------------------------------------------

Not sure how to properly fix this. Only thing I can come up with right now is 
to just ignore viewMap by adding it to this list here: 
[https://github.com/apache/myfaces/blob/89c747e85615e3f33265e664c8361789f38ea7db/impl/src/main/java/org/apache/myfaces/util/DebugUtils.java#L56-L74]

> ViewScope Memory Leak When Trace Enabled
> ----------------------------------------
>
>                 Key: MYFACES-4563
>                 URL: https://issues.apache.org/jira/browse/MYFACES-4563
>             Project: MyFaces Core
>          Issue Type: Bug
>    Affects Versions: 4.0.0-RC4
>            Reporter: Volodymyr Siedlecki
>            Priority: Major
>         Attachments: image-2023-02-15-10-13-40-814.png
>
>
>  I noticed a memory leak occurs when the myfaces trace is specified.
> !image-2023-02-15-10-13-40-814.png|width=348,height=355!
> After the map is cleared (i.e view changes), I see a new contextual storage 
> created during the debug logging, but never removed.
> {noformat}
> ContextualStorage.<init>(BeanManager,boolean) 
> (org/apache/myfaces/cdi/util/ContextualStorage.java:58)
> ViewScopeContextualStorage.<init>(BeanManager) 
> (org/apache/myfaces/cdi/view/ViewScopeContextualStorage.java:36)
> ViewScopeContextualStorageHolder.newContextualStorage(String) 
> (org/apache/myfaces/cdi/view/ViewScopeContextualStorageHolder.java:59)
> ViewScopeContextualStorageHolder.newContextualStorage(String) 
> (org/apache/myfaces/cdi/view/ViewScopeContextualStorageHolder.java:32)
> AbstractContextualStorageHolder.getContextualStorage(String,boolean) 
> (org/apache/myfaces/cdi/util/AbstractContextualStorageHolder.java:111)
> AbstractContextualStorageHolder.getContextualStorage(String) 
> (org/apache/myfaces/cdi/util/AbstractContextualStorageHolder.java:93)
> ViewScopeContextualStorageHolder$Proxy$_$$_WeldClientProxy.getContextualStorage(String)
>  (Unknown Source:-1)
> ViewScopeCDIMap.getStorage() 
> (org/apache/myfaces/cdi/view/ViewScopeCDIMap.java:60)
> ViewScopeCDIMap.getCreationalContextInstances() 
> (org/apache/myfaces/cdi/view/ViewScopeCDIMap.java:67)
> ViewScopeCDIMap.entrySet() 
> (org/apache/myfaces/cdi/view/ViewScopeCDIMap.java:181)
> ViewScopeProxyMap.entrySet() 
> (org/apache/myfaces/view/ViewScopeProxyMap.java:169)
> AbstractMap.toString() (/java.base/java.util/AbstractMap.class:544)
> DebugUtils.printAttribute(PrintStream,String,Object) 
> (org/apache/myfaces/util/DebugUtils.java:373)
> DebugUtils.printComponent(UIComponent,PrintStream,int,boolean,String) 
> (org/apache/myfaces/util/DebugUtils.java:226)
> DebugUtils.printView(UIViewRoot,PrintStream) 
> (org/apache/myfaces/util/DebugUtils.java:147)
> DebugUtils.traceView(String,UIViewRoot) 
> (org/apache/myfaces/util/DebugUtils.java:139)
> DebugUtils.traceView(String) (org/apache/myfaces/util/DebugUtils.java:119)
> LifecycleImpl.render(FacesContext) 
> (org/apache/myfaces/lifecycle/LifecycleImpl.java:266)
> FacesServlet.service(ServletRequest,ServletResponse) 
> (/myfaces-api-4.0.0-RC5-SNAPSHOT.jar/jakarta.faces.webapp/FacesServlet.class:225)
> ServletWrapper.service(ServletRequest,ServletResponse,WebAppServletInvocationEvent)
>  (Unknown Source:1260){noformat}
> This problem only occurs when the trace is specified. The DebugUtils tries to 
> print out the ViewMap and a new storage is created during this process.
> Is seems like there are two ViewMap (ViewScopeCDIMap) used since the storage 
> for the cleared view is marked as deactivated and this other one created a 
> new storage object?
>  
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to