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

Staci Cooper commented on CB-6924:
----------------------------------

I've looked into this with Visual Studio's memory profiler and saw that the 
leak was an issue with the CordovaView. I thought that I had it isolated to the 
CordovaBrowser_Navigated handler, which injects scripts for the 
BrowserDecorators. I narrowed it down to ConsoleHelper, and suspected that the 
issue was related to the OnServiceClosing handler preventing garbage collection 
of the entire Main Page. Commenting out that section cleaned the leak. But 
after playing around with it for awhile and coming back to the code I wasn't 
able to recreate it. I must have been doing something else as well.

I noticed that the CordovaView has an 'IsBrowserInitialized' bool to "prevent 
data clearing during page transitions". It is evaluated during the 
CordovaBrowser_Loaded handler, which returns if it is true and then sets it to 
true before continuing. Is the purpose of this to prevent the CordovaView from 
being reconstructed every time MainPage is loaded? (Which is currently the 
case). Or is this expected behavior?

> Memory leak navigating between native and hybrid pages in WP
> ------------------------------------------------------------
>
>                 Key: CB-6924
>                 URL: https://issues.apache.org/jira/browse/CB-6924
>             Project: Apache Cordova
>          Issue Type: Bug
>          Components: WP8
>    Affects Versions: Master
>            Reporter: Staci Cooper
>            Assignee: Jesse MacFadyen
>         Attachments: memleak.zip
>
>
> Context: Modify HelloWorld Cordova app for WP8 by adding a native page as the 
> start page. Then give it a button to navigate to the Cordova page, 
> MainPage.xaml
> Launch application to opening page (native).
> Click button to go to Cordova page.
> Click hardware back button to go to opening page.
> Repeat 4 times.
> When inspecting the memory profile, you see a steady increase in memory, and 
> 5 copies of MainPage which have not been garbage collected (even if you force 
> garbage collection).
> If this is done enough times the app crashes due to surpassing memory limit.



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to