### 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
VariantParser::Token token;
	VariantParser::get_token(p_stream, token, line, r_err_str);
	if (token.type != VariantParser::TK_NUMBER && token.type != VariantParser::TK_STRING) {
		r_err_str = "Expected number (old style sub-resource index) or String (ext-resource ID)";
		return ERR_PARSE_ERROR;
	}
	r_res.unref();
	VariantParser::get_token(p_stream, token, line, r_err_str);
	if (token.type != VariantParser::TK_PARENTHESIS_CLOSE) {
		r_err_str = "Expected ')'";
		return ERR_PARSE_ERROR;
	}
	return OK;
}
Error Main::setup2() {