290 likes | 385 Views
Low memory and hardware constraints. Andrew Whitechapel Program Manager, Windows Phone Division 2-221. Agenda. Why do you care? Choices for optimizing your reach. Windows Phone resource manager. Best practices. Why do you care?.
E N D
Low memory and hardware constraints Andrew Whitechapel Program Manager, Windows Phone Division 2-221
Agenda • Why do you care? • Choices for optimizing your reach. • Windows Phone resource manager. • Best practices.
Why do you care? • The Windows Phone SDK is a powerful toolset – use it wisely. • Make your app available on the widest range of WP devices possible. • Ensure users have a great experience with your app on all devices, and at all times. • Memory/hardware constraints can make this an interesting challenge. • A desktop OS, and desktop frameworks, on a phone. • We did work to scale to devices; now it’s your turn. • Apps live in an ecosystem on the phone.
Your choices for optimizing your reach • There’s more than one way to slice a lemon. • Breadth targeting. • Selective targeting. • Feature light-up and tuning. • Broad multi-targeting.
Breadth targeting (everything) • Aim for the lowest common denominator. • Eliminate non-universal features/capabilities/memory usage. • Simplest, most robust approach. • Sacrifice some features.
Selective targeting (a subset) • Via OS/platform version. • Single or multiple app versions. • Regional/market targeting. • Via device capabilities ID_CAP* and requirements ID_REQ*. • Sensors. • Memory.
Feature light-up and tuning • Conditionally enable/disable features. • Allow for chassis/platform variation. • IsSupported. • IsXXXSupported. • Reflection: tiles and in-app purchase. • Static versus dynamic. • ID_REQ_MAGNETOMETER versus Compass.IsSupported.
Check for optional features • Fixed (per device) and dynamic (per user selection).
Tile light-up • Reflection is a two-edged sword. • Enhanced tiles: compile for WP7, light-up in WP8. • Rudy Huyn: http://mangopollo.codeplex.com/
Windows Phone resource management • The ResMan mandate: maintain an optimal user experience across all scenarios. • Memory quotas and caps. • CPU quotas and caps. • Sensor resources. • Paging: the pros and cons. • Why do caps vary by app type? • Requesting a higher cap; and the implications.
Memory cap defaults • Caps are not quotas. • Certification 5.25: “An app must not exceed 90 MB of RAM usage, except on devices that have more than 256 MB of memory.” • 95% of apps use <150MB. *Cannot run concurrently with VOIP.
Memory cap breakdown • Juggling behind the scenes. • “Worst case” != “common case”.
Best practices • See Stefan Wick’s talk: 2-216, Friday 10:30. • Building for scale enforces discipline. • Use memory APIs to check your usage (debug and release). • Check for user-disabled features. • Tailor image resolution to device; use thumbnails. • Launchers instead of full controls. • Disable page transitions. • Use virtualized lists, load on demand. • Test on all your target emulators; focus on the LCD. • Test on real devices. • Use the profiler (Store Test Kit). • Use developer.nokia.com remote device access. • Seek out memory spikes.
Out-of-memory conditions • Native allocation failures. • Managed OutOfMemoryExceptions. • Managed framework low-memory conditions and GC. • Failures outside your control.
Memory cap options • Foreground app only. • MAX_CAP == red line on your car rev-counter.
Summary • For maximum success, do work to support the widest range of devices. • Your app belongs to a balanced ecosystem. • Profile your app, query the device, monitor dynamic features and memory.
Resources • App memory limits for Windows Phone 8: http://aka.ms/Tfdyf7 • Developing apps for lower-memory phones: http://aka.ms/To4as5 • The evolution of Windows Phone memory management: http://aka.ms/Jo85ot • Best practice tips for delivering apps with 256 MB: http://aka.ms/Inx8pg • Optimizing apps for lower-cost devices: http://aka.ms/Rwt4ll • App platform compatibility for Windows Phone: http://aka.ms/Y8fxim • Windows Phone 8 Development Internals (book): http://aka.ms/J83ips
Required Slide *delete this box when your slide is finalized Your MS Tag will be inserted here during the final scrub. Evaluate this session • Scan this QR codeto evaluate this session and be automatically entered in a drawing to win a prize!