Samstag, 2. Oktober 2010

Windows Phone 7: Tombstoning tips

After a hard week of optimzing the memory consuption and tombstoning in my current Windows Phone 7 project, here are some of the major points, especially if you working with a multmedia application for Windows Phone 7:

  • Do our own serialization/deseralization (using DataContractSerializer) (because of the 2 MB limitation for transient data)
  • Use virtualization in all lists with a big amount of data (see Shawn Oster | Improving ListBox Performance in Silverlight for Windows Phone 7: Data Virtualization)
  • Work with <WeakReference> for bitmap objects
  • Cleanup references after NavigateFrom
  • If you are using Listboxes with a great amount of data:
    • In NavigateFrom: Set the Listbox items source to null
      • After this the tombstoning is much quicker and memory consumption is lower
      • otherwise the applications crashes here during tombstoning again, because the framework reachs the limit (2MB) with all the bitmaps on the page

Keine Kommentare:

Kommentar veröffentlichen