low memory and hardware constraints

Post on 23-Mar-2016

39 Views

Category:

Documents

1 Downloads

Preview:

Click to see full reader

DESCRIPTION

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?. - PowerPoint PPT Presentation

TRANSCRIPT

Low memory and hardware constraintsAndrew WhitechapelProgram Manager, Windows Phone Division2-221

Why do you care?Choices for optimizing your reach.Windows Phone resource manager.Best practices.

Agenda

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.

The Windows Phone SDK is a powerful toolset – use it wisely.

Why do you care?

Breadth targeting.Selective targeting.Feature light-up and tuning.Broad multi-targeting.

There’s more than one way to slice a lemon.

Your choices for optimizing your reach

Aim for the lowest common denominator.Eliminate non-universal features/capabilities/memory usage.Simplest, most robust approach.Sacrifice some features.

Breadth targeting (everything)

Via OS/platform version.Single or multiple app versions.

Regional/market targeting.Via device capabilities ID_CAP* and requirements ID_REQ*.Sensors.Memory.

Selective targeting (a subset)

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.

Feature light-up and tuning

Fixed (per device) and dynamic (per user selection).

Check for optional features

Reflection is a two-edged sword.

Enhanced tiles: compile for WP7, light-up in WP8.

Rudy Huyn: http://mangopollo.codeplex.com/

Tile light-up

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.

The ResMan mandate: maintain an optimal user experience across all scenarios.

Windows Phone resource management

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.

Memory cap defaultsApp/agent type (WP8)

Low-memory device

High-memory device

VOIP 51 60

Background audio playback

20* 20*

Generic background agents

11* 11

Foreground app 150 150*Cannot run concurrently with VOIP.

Juggling behind the scenes.

“Worst case” != “common case”.

Memory cap breakdownComponent usage (ballpark) 7.1

Lo7.1 Hi

8.0 Lo

8.0 Hi

Total physical 256 512 512 1024

Board support package 80 90 120 130

OS 60 60 220 220

Drivers, services, caches 40 50 50 60

VOIP 0 0 40 60

Background audio 20 20 0 40

Background agents (OEM/MO and GBA)

0 30 30 30

Physical available 56 262 52 484

Acceptable paging 55 55 100 100

Foreground app, backstack, CBE 111 317 152 584

Memory cap breakdown

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.

See Stefan Wick’s talk: 2-216, Friday 10:30.

Building for scale enforces discipline.

Best practices

Native allocation failures.Managed OutOfMemoryExceptions.Managed framework low-memory conditions and GC.Failures outside your control.

Out-of-memory conditions

Demo: memory metrics

Metric 7.1 256

7.1 512

7.8 256

7.8 512

8.0 512

8.0 1024

DeviceTotalMemory 188 425 195 433 512 1024

ApplicationMemoryUsageLimit 110 275 110 283 150 300

ApplicationWorkingSetLimit 57 275 57 283 150 300

ApplicationCurrentMemoryUsage (at start)

5.43 5.58 5.43 5.58 5.23 5.24

Memory metrics – sample run

Memory metrics APIs

Foreground app only.

MAX_CAP == red line on your car rev-counter.

Memory cap optionsApp type Issue Mitigation Result

XAML/.NET

Exceeds MIN_CAP 150MB, but does not exceed MAX_CAP 180MB.

ID_FUNCCAP_EXTEND_MEM

App is not opted out of low-mem devices, but gets MAX_CAP 180MB.

XAML/.NET

Exceeds low-mem MAX_CAP 180MB.

ID_REQ_MEMORY_300 App is opted out of low-mem devices. On high-mem devices, it gets MIN_CAP 300MB.

XAML/.NET

Exceeds high-mem MAX_CAP 300MB.

ID_REQ_MEMORY_300 ID_FUNCCAP_EXTEND_MEM

App is opted out of low-mem devices, and gets the higher cap 380MB.

XNA/Native

Exceeds MIN_CAP 150MB, but does not exceed MAX_CAP 180MB.

ID_FUNCCAP_EXTEND_MEM

App is not opted out of low-mem devices, but gets the higher cap 180MB.

XNA/Native

Exceeds MAX_CAP 180MB.

ID_REQ_MEMORY_300 ID_FUNCCAP_EXTEND_MEM

App is opted out of low-mem devices, and gets the higher cap 380MB.

Memory cap options

Screen resolution and scaling

Resolution Width Height Frame MB

Buffers Total MB

WVGA 480 800 1.46 5 7.32

720p 720 1280 3.52 5 17.58

WXGA 768 1280 3.75 5 18.75

Where, e.g., WXGA = 5*(768*1280)*(32/8)/1024/1024 =

18.75

Multi-res

Demo: test image scaling

Image scalingResolution Image size App

memoryGrowth

(No image) 18.07

Un-scaled 444 x 300 18.65 0.58

WVGA 800 x 480 19.89 1.82

720p 1280 x 720 21.95 3.88

WXGA 1280 x 768 22.18 4.11

HD 1920 x 1080 26.36 8.29

(Original) 5184 x 3456 61.38 43.31

Thumbnail (spike) 110 x 90 19.21 1.14

Thumbnail (stable)

110 x 90 15.93 -2.14

Original (decode set)

5184 x 3456 18.79 0.72

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.

Summary

ResourcesApp memory limits for Windows Phone 8: http://aka.ms/Tfdyf7Developing apps for lower-memory phones: http://aka.ms/To4as5The 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

Evaluate this session

Scan this QR code to evaluate this session and be automatically entered in a drawing to win a prize!

© 2013 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries.The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

top related