160 likes | 332 Views
Windows 8 . NET Store Apps Debugging. Mario Hewardt Senior Developer PFE. Objectives. Investigate a memory problem in a Windows 8 Store Application Learn how to quickly triage possible memory problems in .NET using PerfMon Learn how to control Windows 8 Process Lifetime Management
E N D
Windows 8 .NET Store Apps Debugging Mario Hewardt Senior Developer PFE
Objectives • Investigate a memory problem in a Windows 8 Store Application • Learn how to quickly triage possible memory problems in .NET using PerfMon • Learn how to control Windows 8 Process Lifetime Management • Learn how to dig deeper into the managed heap to find root cause • Learn new .NET 4.5 debug switches for more efficient debugging
Windows 8 and .NET Magic • No magic • Just a new .NET version with an improved GC • BUT – PLM can throw you for a loop • Bottom line – Debugging applications under control of PLM can change your debugging experience
.NET Memory Basics - SOH • Small object heap • < 85000 bytes • Compacted and beautiful • Few exceptions one common one is: Pinning
.NET Memory Basics - LOH • Large Object heap • >= 85000 bytes • Not compacted • Recently released preview of .NET 4.5.1 includes the ability to compact LOH programmatically
.NET Memory Basics – GC Modes • Server • Workstation • 4.0 Background (workstation) • 4.5 Background (server)
The Memory Hogging Application • Application plays the XBox One ‘Reveal’ video • Complaint: Application uses excessive memory • Short video clip uses close to 1GB of memory
Step 2 – Windows 8 PLM • In previous versions of Windows, user controlled the lifetime of a process • In Windows 8, it itself can as well • Process Lifetime Management (PLM) component • Used as a means to conserve energy/battery
PLM States Running Suspended Stopped
PLM and Debugging • As a process transitions throughout the state machine, debugging can be effected • What happens if you attach when its suspended? • Key is to control the PLM policy • Rather, disable it when we debug
Walkthrough • New switches to !DumpHeap command