Created
May 2, 2017 23:26
-
-
Save doggan/0bab62d1d265f82e9831b0ea78b19fcd to your computer and use it in GitHub Desktop.
Unity WebGL Memory Usage
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Ref: http://developers.kongregate.com/blog/unity-webgl-memory-and-performance-optimization | |
setInterval(function() { | |
if (typeof TOTAL_MEMORY !== 'undefined') { | |
try { | |
var totalMem = TOTAL_MEMORY/1024.0/1024.0; | |
var usedMem = (TOTAL_STACK + (STATICTOP - STATIC_BASE) + | |
(DYNAMICTOP - DYNAMIC_BASE))/1024.0/1024.0; | |
console.log('Memory stats - used: ' + Math.ceil(usedMem) + 'M' + | |
' free: ' + Math.floor(totalMem - usedMem) + 'M'); | |
} catch(e) {} | |
} | |
}, 5000); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
not work when builded by unity 5.6.3p2.
I have posted my version here https://forum.unity.com/threads/unity3d-5-6-webgl-memory-usage.464703/#post-3298200
Could you help me?