### Godot version

4.2.stable (.NET version)

### System information

macOS Ventura 13.6.1, MacBook 2017 Intel Core i5, Iris Plus 650, 16 GB ram

### Issue description

My friend was testing my Godot project (which has the Compatibility rendering method configured) and he said that his MacBook quickly ran out of memory. The game was allocating 15 GB of RAM after a minute or two. More interestingly, the same happened with the 2D platformer demo project from https://github.com/godotengine/godot-demo-projects, when running in Compatibility mode. My Windows machine doesn't suffer from this at all.

Fortunately, we figured out that switching to Forward+ mode fixed the issue. The downside is that I have now lost a potential audience of devices that need Compatibility rendering.

Here's what he saw in the profiler:

![WhatsApp Image 2023-12-01 at 17 00 58_40cb5e91](https://github.com/godotengine/godot/assets/260737/465c686b-1092-41dd-bd48-e46e14af3ce1)

By the way, when my friend closes the editor, he gets the following which might be related (I have no idea but who knows):

![image](https://github.com/godotengine/godot/assets/260737/92273df8-d52c-46d8-8db4-1b561e630462)



### Steps to reproduce

Run the 2D platformer demo project from https://github.com/godotengine/godot-demo-projects and set it to the Compatibility rendering method (or possibly any other game that can run in this mode) on a MacBook (maybe only one that matches the provided system specs or maybe any Mac, I don't know).

### Minimal reproduction project

2D/platformer demo from https://github.com/godotengine/godot-demo-projects in Compatibility rendering mode
OS::get_singleton()->print("                                    <path> should be absolute or relative to the project directory, and include the filename for the binary (e.g. 'builds/game.exe').\n");
	OS::get_singleton()->print("                                    The target directory must exist.\n");
	OS::get_singleton()->print("  --export-debug <preset> <path>    Export the project in debug mode using the given preset and output path. See --export-release description for other considerations.\n");
	OS::get_singleton()->print("  --export-pack <preset> <path>     Export the project data only using the given preset and output path. The <path> extension determines whether it will be in PCK or ZIP format.\n");
#ifndef DISABLE_DEPRECATED
	OS::get_singleton()->print("  --convert-3to4 [<max_file_kb>] [<max_line_size>]\n");
	OS::get_singleton()->print("                                    Converts project from Godot 3.x to Godot 4.x.\n");
	OS::get_singleton()->print("  --validate-conversion-3to4 [<max_file_kb>] [<max_line_size>]\n");
	OS::get_singleton()->print("                                    Shows what elements will be renamed when converting project from Godot 3.x to Godot 4.x.\n");
#endif 
	OS::get_singleton()->print("  --doctool [<path>]                Dump the engine API reference to the given <path> (defaults to current dir) in XML format, merging if existing files are found.\n");
	OS::get_singleton()->print("  --no-docbase                      Disallow dumping the base types (used with --doctool).\n");
#ifdef MODULE_GDSCRIPT_ENABLED
	OS::get_singleton()->print("  --gdscript-docs <path>            Rather than dumping the engine API, generate API reference from the inline documentation in the GDScript files found in <path> (used with --doctool).\n");
#endif
	OS::get_singleton()->print("  --build-solutions                 Build the scripting solutions (e.g. for C# projects). Implies --editor and requires a valid project to edit.\n");
	OS::get_singleton()->print("  --dump-gdextension-interface      Generate GDExtension header file 'gdextension_interface.h' in the current folder. This file is the base file required to implement a GDExtension.\n");
	OS::get_singleton()->print("  --dump-extension-api              Generate JSON dump of the Godot API for GDExtension bindings named 'extension_api.json' in the current folder.\n");
	OS::get_singleton()->print("  --dump-extension-api-with-docs    Generate JSON dump of the Godot API like the previous option, but including documentation.\n");
	OS::get_singleton()->print("  --validate-extension-api <path>   Validate an extension API file dumped (with one of the two previous options) from a previous version of the engine to ensure API compatibility. If incompatibilities or errors are detected, the return code will be non zero.\n");
	OS::get_singleton()->print("  --benchmark                       Benchmark the run time and print it to console.\n");
	OS::get_singleton()->print("  --benchmark-file <path>           Benchmark the run time and save it to a given file in JSON format. The path should be absolute.\n");
#ifdef TESTS_ENABLED
	OS::get_singleton()->print("  --test [--help]                   Run unit tests. Use --test --help for more information.\n");
#endif
#endif
	OS::get_singleton()->print("\n");
}
#ifdef TESTS_ENABLED
Error Main::test_setup() {