Skip to content

Instantly share code, notes, and snippets.

@shiftkey
Created February 4, 2011 01:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shiftkey/810610 to your computer and use it in GitHub Desktop.
Save shiftkey/810610 to your computer and use it in GitHub Desktop.
Investigating memory usage of a trivial Panorama-based WP7 application.
// Scenario:
// Start with default WP7 Panorama application, two tabs each with listbox
// Added child page with panorama control, two tabs each with listbox
// Two ViewModels (Main and Child), each has a list of 270+ items
// No relationship between the ViewModels. Lazy-loaded data in-memory
Main - OnNavigatedTo - ApplicationCurrentMemoryUsage: 8036352
Main - OnNavigatedTo - ApplicationPeakMemoryUsage: 8048640
Main - Loaded - ApplicationCurrentMemoryUsage: 39870464
Main - Loaded - ApplicationPeakMemoryUsage: 39899136
// scroll listbox, select an item to navigate to child page
Main - OnNavigatedFrom - ApplicationCurrentMemoryUsage: 52854784 // second view created - increase by 13MB
Main - OnNavigatedFrom - ApplicationPeakMemoryUsage: 52936704
Child - OnNavigatedTo - ApplicationCurrentMemoryUsage: 52854784
Child - OnNavigatedTo - ApplicationPeakMemoryUsage: 52936704
Child - Loaded - ApplicationCurrentMemoryUsage: 64663552 // second viewmodel created - increase by 12MB
Child - Loaded - ApplicationPeakMemoryUsage: 64712704
// scroll listbox, press Back on device to return to Main View
Child - OnNavigatedFrom - ApplicationCurrentMemoryUsage: 41127936 // framework has suspended main view and freed additional space
Child - OnNavigatedFrom - ApplicationPeakMemoryUsage: 70279168
Main - OnNavigatedTo - ApplicationCurrentMemoryUsage: 41127936
Main - OnNavigatedTo - ApplicationPeakMemoryUsage: 70279168
Child - Unloaded - ApplicationCurrentMemoryUsage: 41127936
Child - Unloaded - ApplicationPeakMemoryUsage: 70279168
Main - Loaded - ApplicationCurrentMemoryUsage: 77934592 // expect both views to be in-memory at this point, but footprint approx 13MB larger!
Main - Loaded - ApplicationPeakMemoryUsage: 77934592
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment