Presentation is loading. Please wait.

Presentation is loading. Please wait.

Low memory and hardware constraints

Similar presentations


Presentation on theme: "Low memory and hardware constraints"— Presentation transcript:

1

2 Low memory and hardware constraints
Andrew Whitechapel Program Manager, Windows Phone Division 2-221

3 Agenda Why do you care? Choices for optimizing your reach.
Build 2013 6/22/2018 Agenda Why do you care? Choices for optimizing your reach. Windows Phone resource manager. Best practices. © 2013 Microsoft Corporation. All rights reserved. Microsoft, Windows, 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.

4 Build 2013 6/22/2018 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. © 2013 Microsoft Corporation. All rights reserved. Microsoft, Windows, 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.

5 Your choices for optimizing your reach
Build 2013 6/22/2018 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. © 2013 Microsoft Corporation. All rights reserved. Microsoft, Windows, 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.

6 Breadth targeting (everything)
Aim for the lowest common denominator. Eliminate non-universal features/capabilities/memory usage. Simplest, most robust approach. Sacrifice some features.

7 Selective targeting (a subset)
Build 2013 6/22/2018 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. © 2013 Microsoft Corporation. All rights reserved. Microsoft, Windows, 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.

8 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.

9 Check for optional features
Fixed (per device) and dynamic (per user selection).

10 Tile light-up Reflection is a two-edged sword.
Enhanced tiles: compile for WP7, light-up in WP8. Rudy Huyn:

11 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.

12 Memory cap defaults App/agent type (WP8) Low-memory device
Build 2013 6/22/2018 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. App/agent type (WP8) Low-memory device High-memory device VOIP 51 60 Background audio playback 20* Generic background agents 11* 11 Foreground app 150 *Cannot run concurrently with VOIP. © 2013 Microsoft Corporation. All rights reserved. Microsoft, Windows, 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.

13 Memory cap breakdown Juggling behind the scenes.
“Worst case” != “common case”. Component usage (ballpark) 7.1 Lo 7.1 Hi 8.0 Lo 8.0 Hi Total physical 256 512 1024 Board support package 80 90 120 130 OS 60 220 Drivers, services, caches 40 50 VOIP Background audio 20 Background agents (OEM/MO and GBA) 30 Physical available 56 262 52 484 Acceptable paging 55 100 Foreground app, backstack, CBE 111 317 152 584

14 Memory cap breakdown

15 Best practices See Stefan Wick’s talk: 2-216, Friday 10:30.
Build 2013 6/22/2018 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. © 2013 Microsoft Corporation. All rights reserved. Microsoft, Windows, 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.

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

17 Demo: memory metrics

18 Memory metrics – sample run
DeviceTotalMemory 188 425 195 433 512 1024 ApplicationMemoryUsageLimit 110 275 283 150 300 ApplicationWorkingSetLimit 57 ApplicationCurrentMemoryUsage (at start) 5.43 5.58 5.23 5.24

19 Memory metrics APIs

20 Memory cap options Foreground app only.
Build 2013 6/22/2018 Memory cap options Foreground app only. MAX_CAP == red line on your car rev-counter. App 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. 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. 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 App is not opted out of low-mem devices, but gets the higher cap 180MB. Exceeds MAX_CAP 180MB. © 2013 Microsoft Corporation. All rights reserved. Microsoft, Windows, 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.

21 Memory cap options

22 Screen resolution and scaling
Width Height Frame MB Buffers Total MB WVGA 480 800 1.46 5 7.32 720p 720 1280 3.52 17.58 WXGA 768 3.75 18.75 Where, e.g., WXGA = 5*(768*1280)*(32/8)/1024/1024 =

23 Multi-res

24 Demo: test image scaling

25 Image scaling Resolution Image size App memory Growth (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) 15.93 -2.14 Original (decode set) 18.79 0.72

26 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.

27 Resources App memory limits for Windows Phone 8: http://aka.ms/Tfdyf7
Developing apps for lower-memory phones: The evolution of Windows Phone memory management: Best practice tips for delivering apps with 256 MB: Optimizing apps for lower-cost devices: App platform compatibility for Windows Phone: Windows Phone 8 Development Internals (book):

28 6/22/ :20 PM 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 code to evaluate this session and be automatically entered in a drawing to win a prize! © 2013 Microsoft Corporation. All rights reserved. Microsoft, Windows, 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.

29


Download ppt "Low memory and hardware constraints"

Similar presentations


Ads by Google