Godot Version
Version 4.6.1 stable
Problem
I’m checking Static Memory consumption in order to optimize my web game:
var mem = Performance.get_monitor(Performance.MEMORY_STATIC) / 1024.0 / 1024.0
print(mem)
The problem is that when exporting the game to web, the Memory seems to increase by 0.02MB around every 3 seconds without capping at a fixed amount.
I’ve tried to isolate the problem by disabling systems of my game one by one, but I wasn’t able to find the cause. At the end I decided to create a new empty project that only checks Static Memory consumption. But despite not having any other systems or processes besides the Memory printer, Static Memory still increases by the rate mentioned before.
All project settings are at default, I’m using the Compatibility renderer and there aren’t any added addons or other systems besides this script and the label nodes:
```
extends Control
func _ready() -> void:
_show_resources()
# Show the currently used resources only when pressing Enter
func _input(event: InputEvent) -> void:
if event.is_action_pressed("enter"):
_show_resources()
# Updates the labels with the resources
func _show_resources() -> void:
var mem := str(Performance.get_monitor(Performance.MEMORY_STATIC) / 1024.0 / 1024.0,)
var ob_count := str(Performance.get_monitor(Performance.OBJECT_COUNT))
var ob_node := str(Performance.get_monitor(Performance.OBJECT_NODE_COUNT))
var ob_res := str(Performance.get_monitor(Performance.OBJECT_RESOURCE_COUNT))
%Memory_static.text = "MEM STATIC: %s" % mem
%Object_count.text = "Object Count: %s" % ob_count
%Object_node_count.text = "Object Node: %s" % ob_node
%Object_resource_count.text = "Object_Resource: %s" % ob_res
```
This happens in the Remote Deploy of the engine, and in both desktop and mobile when executing it on a browser.