How to Control Runtime Memory in Unity Mobile Games: PSS Standards, Memory Profiler Analysis, and Optimization Workflows
Most Unity mobile game crashes caused by Out-of-Memory (OOM) issues originate from excessive runtime memory usage.In production environments, PSS Total (Proportional Set Size) is one of the most important indicators for evaluating actual memory consumption because it reflects the physical memory footprint of a game process. When memory usage approaches device limits, Android may terminate the game process during gameplay or when the application is moved to the background.
This article explains how Unity runtime memory is structured, how Memory Profiler and Android system tools expose memory consumption, and how GameOptim recommends analyzing and controlling memory usage to reduce crash risks across different device tiers.
About GameOptim GameOptim helps Unity developers identify memory issues, rendering bottlenecks, and performance regressions through automated profiling and cloud based performance analysis. Explore more: 🌐 Website: www.gameoptim.com https://www.gameoptim.com/?fopt=blog 📘 Blog: www.gameoptim.com/blog/ https://www.gameoptim.com/blog/ 💼 LinkedIn: Gameoptim https://www.linkedin.com/company/gameoptim/ 🎥 YouTube: GO.PerformanceLab https://www.youtube.com/@GO.PerformanceLab 💬 Discord: GameOptim https://discord.gg/4Jh6hj9gRw ⭐ GitHub: Gameoptim https://github.com/GameOptim/unity mobile performance guide 💻 Dev: GameOptim https://dev.to/gameoptim https://uwa overseas images.oss us east 1.aliyuncs.com/Blog/HeadImage/OptimizationGuide2%280%29.jpg Summary Runtime memory issues in Unity are primarily reflected in PSS Total, which represents actual physical memory usage of a process. RSS Total tends to overestimate memory usage due to full inclusion of shared libraries, making it less reliable for diagnosis. Android OOM crashes occur when system memory pressure forces termination of low priority processes such as games. Unity Memory Profiler alone is insufficient; system level tools like adb dumpsys meminfo are required for full memory analysis. Memory issues should be decomposed into Tracked Memory, Untracked Memory, and system level Native Heap usage. Safe PSS memory usage should remain below 50–60% of total device RAM to avoid crash risk. 1. Runtime Memory Usage Analysis PSS Total Primary Runtime Metric PSS Total represents the actual physical memory usage of a process, where shared memory is proportionally distributed across processes. It is the most accurate metric for evaluating Unity runtime memory footprint. RSS Total Secondary Reference Metric RSS Total includes full shared library memory in each process. This leads to inflated memory values and reduces its diagnostic reliability compared to PSS. Runtime Memory Risk Mechanism When system memory usage reaches a high threshold: Android OS triggers memory pressure recovery Low priority processes including games are terminated first This leads to Out of Memory OOM crashes in crash logs 1. Unity Memory Profiler Analysis Unity Memory Profiler provides two major versions with structural differences: Memory Profiler 0.7.1 1 https://uwa ducument img.oss cn beijing.aliyuncs.com/GameOptim/2.1Overview/1.png Key characteristics: Clear separation of In use vs Reserved memory Summary view divides memory into three main categories Reserved memory reflects engine allocation overhead 2 https://uwa ducument img.oss cn beijing.aliyuncs.com/GameOptim/2.1Overview/2.png Limitation: Inconsistent category hierarchy Requires manual filtering for meaningful breakdown e.g., Manager, SerializedFile Memory Profiler 1.1.0 3 https://uwa ducument img.oss cn beijing.aliyuncs.com/GameOptim/2.1Overview/3.png Improvements: Simplified summary structure Expanded classification into five asset types Improved usability for diagnosis Limitation: Reserved memory is merged into Native IL2CPP VM memory appears as Unknown 4 https://uwa ducument img.oss cn beijing.aliyuncs.com/GameOptim/2.1Overview/4.png 5 https://uwa ducument img.oss cn beijing.aliyuncs.com/GameOptim/2.1Overview/5.png Key observation: Large Unknown memory often originates from: AssetBundle compression e.g., LZMA VM / system level allocations Not all Unknown memory indicates leakage 2. System Level Memory Analysis ADB Unity profiling must be validated at system level: 6 https://uwa ducument img.oss cn beijing.aliyuncs.com/GameOptim/2.1Overview/6.png Key memory components: Native Heap Gfx dev / EGL mtrack / GL mtrack Unknown Memory Attribution Rules Unity rendering memory → Gfx / EGL / GL mtrack External libraries/plugins → Native Heap / Unknown System level allocations → Unknown Diagnostic Conditions Memory risk is likely when: Gfx + EGL + GL + Unknown Unity Tracked Memory Native Heap shows continuous growth trend Engineering Strategy Use A/B builds to isolate plugin memory impact Use plugin native profilers e.g., Wwise Use GOT Online Lua Mode for Lua heavy projects Use Perfetto for deep Native Heap tracing GameOptim Insight Native Heap growth is one of the most common hidden memory issues in production Unity projects and cannot be fully diagnosed using Unity tools alone. Best Practices Always prioritize PSS Total over RSS Total for crash analysis Combine Unity Profiler + adb + Perfetto for full stack memory tracing Monitor Unknown memory as a diagnostic signal, not a final conclusion Separate asset memory and runtime heap memory in analysis Validate plugin memory behavior using A/B builds Avoid relying on single frame snapshots for memory diagnosis Key Takeaways Runtime Memory PSS Total is the most reliable runtime memory metric in Unity mobile games RSS Total overestimates memory due to full shared library accounting Android OOM is triggered by system memory pressure, not just app usage Unity Memory Profiler must be combined with system level tools for accuracy Unknown memory is not always a leak signal Native Heap growth is a key indicator of external memory issues 2. Memory Parameter Standards Safe Memory Threshold Principle Game crash risk increases significantly when PSS exceeds: → 50%–60% of total device RAM This threshold reflects Android system memory pressure behavior. Mono Heap Sensitivity Mono heap affects: GC pause duration Runtime allocation stability Memory fragmentation risk It requires stricter monitoring than other memory types. Device Level Memory Safety Limits 2GB devices → PSS ≤ 1GB 3GB devices → PSS ≤ 1.5GB 4GB devices → PSS ≤ 2GB <table border="1" cellpadding="8" cellspacing="0" style="border collapse: collapse; width: 100%;" <tr < 核心:Memory Type 跨2行+2列,合并目标3个格子 <td rowspan="2" colspan="2" style="text align: center; font weight: bold;" Memory Type</td < Recommended Value 跨3列(2G/3G/4G) <td colspan="3" style="text align: center; font weight: bold;" Recommended Value</td </tr <tr < 2G/3G/4G 列头 <td style="text align: center;" 2G</td <td style="text align: center;" 3G</td <td style="text align: center;" 4G</td </tr <tr < Total Memory 跨2行 <td rowspan="2" style="text align: center; font weight: bold;" Total Memory</td <td style="text align: center;" PSS Total</td <td style="text align: center;" 1 GB</td <td style="text align: center;" 1.5 GB</td <td style="text align: center;" 2 GB</td </tr <tr <td style="text align: center;" Reserved Total</td <td style="text align: center;" 700 MB</td <td style="text align: center;" 1.2 GB</td <td style="text align: center;" 1.5 GB</td </tr <tr < Resources Memory 跨4行 <td rowspan="4" style="text align: center; font weight: bold;" Resources Memory</td <td style="text align: center;" Texture</td <td style="text align: center;" 140 MB</td <td style="text align: center;" 210 MB</td <td style="text align: center;" 280 MB</td </tr <tr <td style="text align: center;" Mesh</td <td style="text align: center;" 60 MB</td <td style="text align: center;" 100 MB</td <td style="text align: center;" 140 MB</td </tr <tr <td style="text align: center;" Shader</td <td style="text align: center;" 40 MB</td <td style="text align: center;" 50 MB</td <td style="text align: center;" 60 MB</td </tr <tr <td style="text align: center;" Animation Clip</td <td style="text align: center;" 40 MB</td <td style="text align: center;" 60 MB</td <td style="text align: center;" 80 MB</td </tr <tr < Mono Heap Memory <td style="text align: center; font weight: bold;" Mono Heap Memory</td <td </td <td style="text align: center;" 80 MB</td <td style="text align: center;" 100 MB</td <td style="text align: center;" 120 MB</td </tr <tr < Lua Memory <td style="text align: center; font weight: bold;" Lua Memory</td <td </td <td style="text align: center;" 100 MB</td <td style="text align: center;" 100 MB</td <td style="text align: center;" 100 MB</td </tr </table Asset & Pipeline Standards Define memory budgets early in production Translate budgets into art production constraints Enforce compliance via automated validation tools Segment assets into quality tiers when needed Maintain alignment between engineering and art teams Best Practices Set memory ceilings based on device tiers early in development Prioritize PSS reduction over Reserved optimization Treat Mono heap as a high risk GC factor Automate asset compliance checking in pipelines Validate memory impact using real device testing Adjust standards based on project type 2D vs 3D Key Takeaways Memory Standards Safe PSS usage should remain within 50–60% of device RAM Mono heap has a direct impact on GC performance and stability Texture memory is the dominant contributor in most Unity projects Memory budgets must be enforced through pipeline automation Standards must be adapted to project architecture and device targets Engineering and art alignment is critical for memory stability FAQ What is the safest memory limit for Unity mobile games? Typically 50–60% of device RAM based on Android memory pressure behavior. Why is PSS more important than RSS? Because it reflects proportional real memory usage instead of overcounting shared libraries. What causes most Unity memory crashes? Excessive PSS usage and uncontrolled Native Heap growth. Why does Unknown memory appear in profiling tools? It often includes system allocations, IL2CPP memory, or compressed asset bundles. How can memory issues be reliably diagnosed? By combining Unity Memory Profiler, adb dumpsys meminfo, and Perfetto tracing. Why is Mono heap critical? Because it directly impacts GC pauses and runtime stability. Should memory limits be fixed across all projects? No, they must be adjusted based on project type and platform. How can memory standards be enforced in production? Through automated asset validation and engineering pipelines e.g., GameOptim tooling . Continue reading the series 1. Why Do Mobile Games Crash, Lag, or Overheat? A Unified Framework for CPU, GPU, and Memory Optimization in Unity https://www.gameoptim.com/blog/post/OptimizationGuide1 3. Common Resource Memory Issues in Unity Mobile Games https://www.gameoptim.com/blog/post/OptimizationGuide3 4. Why Is Texture Memory So High in Unity Mobile Games? https://www.gameoptim.com/blog/post/OptimizationGuide4 5. How Do Vertex Count, Vertex Attributes, and Read/Write Settings Affect Mesh Performance in Unity Mobile Games? https://www.gameoptim.com/blog/post/OptimizationGuide5 6. How Can You Reduce Animation Memory Usage and Runtime Overhead in Unity Mobile Games? https://www.gameoptim.com/blog/post/OptimizationGuide6 7. How Can You Reduce Audio Memory Usage and Playback Overhead in Unity Mobile Games? https://www.gameoptim.com/blog/post/OptimizationGuide7 8. How Can You Reduce Material Count and Avoid Material Related Performance Waste in Unity Mobile Games? https://www.gameoptim.com/blog/post/OptimizationGuide8 9. How Can You Reduce Render Texture Memory Usage and Rendering Overhead in Unity Mobile Games? https://www.gameoptim.com/blog/post/OptimizationGuide9 10. What Causes Excessive Shader Memory Usage and Variant Explosion in Unity Mobile Games? https://www.gameoptim.com/blog/post/OptimizationGuide10 11. Why Do Font and Particle System Resources Consume Excessive Memory in Unity Mobile Games? https://www.gameoptim.com/blog/post/OptimizationGuide11 12. Why Does Mono Heap Memory Keep Growing and Trigger GC Spikes in Unity Mobile Games? https://www.gameoptim.com/blog/post/OptimizationGuide12 13. Why Is Memory Usage Still High After Optimizing Unity Resources? https://www.gameoptim.com/blog/post/OptimizationGuide13 14. What Defines a CPU Bottleneck in Unity Mobile Games? https://www.gameoptim.com/blog/post/OptimizationGuide14 15. Unity Rendering CPU Optimization: Why Is Rendering Time So High? https://www.gameoptim.com/blog/post/OptimizationGuide15 16. What Causes UI Performance Bottlenecks in Unity Mobile Games? https://www.gameoptim.com/blog/post/OptimizationGuide16 17. Is Unity Physics Wasting CPU Time on Mobile? How to Detect and Reduce Hidden Physics Overhead https://www.gameoptim.com/blog/post/OptimizationGuide17 18. Why Is Unity Animation Taking Too Much CPU on Mobile? https://www.gameoptim.com/blog/post/OptimizationGuide18 19. How to Reduce Particle System CPU Spikes and Runtime Overhead in Unity Mobile Games? https://www.gameoptim.com/blog/post/OptimizationGuide19 20. How Can I Reduce Unity Loading Time and Avoid Runtime Stutters? https://www.gameoptim.com/blog/post/OptimizationGuide20 21. How Can I Optimize Unity Logic Code, Lua, and Hotfix Runtime Performance? https://www.gameoptim.com/blog/post/OptimizationGuide21 22. How Do I Identify GPU Bottlenecks in Unity Mobile Games? https://www.gameoptim.com/blog/post/OptimizationGuide22 23. How can developers accurately determine whether a Unity mobile game is GPU Bound using GPU Clocks? https://www.gameoptim.com/blog/post/OptimizationGuide23 24. How can developers identify and optimize GPU vertex stage bottlenecks in Unity mobile games? https://www.gameoptim.com/blog/post/OptimizationGuide24 25. How can developers identify and reduce GPU fragment stage bottlenecks in Unity mobile games? https://www.gameoptim.com/blog/post/OptimizationGuide25 26. How to Reduce Shader Complexity in Unity Mobile Games? https://www.gameoptim.com/blog/post/OptimizationGuide26 27. How to Optimize Post processing in Unity Mobile Games? https://www.gameoptim.com/blog/post/OptimizationGuide27 28. How to Reduce GPU Bandwidth in Unity Mobile Games? https://www.gameoptim.com/blog/post/OptimizationGuide28 29. Why Does My Unity Mobile Game Overheat, Drain Battery Fast, and Drop FPS After a While? https://www.gameoptim.com/blog/post/OptimizationGuide29