Netcf Gc
-
Upload
rsnarayanan -
Category
Technology
-
view
437 -
download
1
Transcript of Netcf Gc
64K object pools Large (>16K) and
huge objects (>64K) Per app domain
finalizer thread
Memory architecture
Pool 0 Pool 1
Pool 2
App State
Fast free
Targeted towards diverse devices Non generational mark-sweep-compaction Highest cost is compaction
◦ Fired when fragmentation > 750K GC can trigger code pitching GC triggers
◦ Allocation fails◦ Quanta of allocation◦ User code forces GC◦ When app goes to background
NETCF GC - Current State
Actively engaging with ◦ Desktop SL team◦ Desktop CLR GC folks◦ XNA team
Measure, measure and then measure some more
Development of tools for memory simulations
Current investigations – Data Collection
60% to 85% of memory in native heap with 80 MB working set◦ Native heap allocations don’t impact GC perf◦ Images, in native heap, dominate working set
Desktop GC inadequate in this scenario Unsuccessfully attempted Add/Remove
Memory pressure SL drives GC Suggested we tweak our GC to be total
memory aware and expose hosting API
SL Desktop
Memory simulation
Tools
GC Perf Data for Managed Allocs
1 2 3.2 4.3 5.5 6.7 7.8 9 100
50
100
150
200
250
Garbage per sec:100K
Managed Heap Working Set
GC latency (milli sec)
Samsung Mirage
OMAP - 10 mb managed data1. Without 60ms2. With compaction 186ms3. 26MB Compaction 324ms
60-80% of working set is native Linear degradation with increase in managed
working set Expected max is 50MB Managed WS < 10MB generally works fine Managed WS >100MB experiences “hangs” UI over web-services, small data works fine UI over large in-memory data has large startup
time Multi-media, games can have small freezes
(200ms) on full GC SL apps with lot of native memory may run into
OOM even when memory can be reclaimed
Apps and Issues
Refactoring to allow GC in-built profiles Auto-tuning to reduce the number of GC Configurability Hosting changes
Current Investigation - Prototypes
Auto tune internal thresholds◦ Collection threshold/budget◦ Fragmentation threshold for compaction
Native allocation aware System memory aware Low memory state
Auto Tuning
Support GC policies◦ Currently limited hand tuning for entire CLR◦ Per process GC config (*.exe.config)
Downloaded application cannot override System applications can change Quanta, disable
pitching Add GC Hosting API’s
◦ ICLRHostManager::Collect◦ ICLRManager::SetGCStartupLimits◦ IHostMemoryManager::GetMemoryLoad◦ IHostGCManager::GCNotification
Configurable
CE 6.0 memory model changes Hand optimization Generational GC
◦ Current data on desktop SL suggests against it
Other changes
Xbox and other large systems bring in special challenges
Per CPU heap/allocation context Parallel GC on multi-proc systems Pre-fetch Current focus is Mobile scenarios
Platform specific
http://blogs.msdn.com/abhinaba/archive/tags/Garbage+Collection/default.aspx
http://sharepointasia/sites/mobiledev/netcf/NETCF%20Internal%20Documents/CF%20Design/Proposed%20changes%20to%20Garbage%20Collector.mht
CLRProfiler Remote Performance Monitor
Resources