WebGL memory tracker for Defold

A quick and easy way to find out the GPU and CPU memory usage of your Defold game on HTML5 platform.

So, this is an adaptation into a native extension of the excellent WebGL-Memory library for the Defold engine. You add the extension to your project, then you can ask how much WebGL memory and resources you’re using. As a tiny extra bonus, this extension retrieves the size of the heap used by the game.

More → https://github.com/indiesoftby/defold-webgl-memory

How to use this data

This is written from my perspective - if anything is wrong, please correct me.

In HTML5 your main task is to minimise the memory consumption of the game. Firstly, modern mobile browsers have OOM protection and the browser can simply stop running your game, show warning to a user and free up resources for other tasks if memory usage is too high. Secondly, allocating a large amount of memory for your game requires freeing up device resources, and this can lead to lags and slow startup of your HTML5 game.

  • Minimise the required heap size. Set the game.project heap size to 32 megabytes (minimum). Run the HTML5 build of your game and check the value of webgl_memory.get_info().memory.wasmheap. If it is greater than 32 megabytes, increase this parameter and run the game again.
  • Use texture compression: 16bpp or UASTC if their output image quality is OK to you. They will significantly reduce the size of the consumed video memory and speed up the performance of your game.
  • Use 2k atlases instead of 4k/8k atlases to reduce required heap size. Uncompressed RGBA 4k atlas with mipmaps uses 85x2 (190) megabytes of heap just to transfer it to the video adapter memory.
12 Likes