Skip to content

Instantly share code, notes, and snippets.

@doggan
Created May 2, 2017 23:26
Show Gist options
  • Save doggan/0bab62d1d265f82e9831b0ea78b19fcd to your computer and use it in GitHub Desktop.
Save doggan/0bab62d1d265f82e9831b0ea78b19fcd to your computer and use it in GitHub Desktop.
Unity WebGL Memory Usage
// 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);
@Pro100AlexHell
Copy link

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment