Weird possible memory leak but only when game is exported, not on editor
Asked Answered
B

7

0

When starting the game from an exported version it tries to alocate memory until reaches my pc's maximum and crashes returning said error. When I run in the editor it takes 1.4gb of ram to run, but when the exported version launches it keeps growing the memory used and never launches, crashing as a result.

Returned error:
ERROR: Condition "!_ptrnew" is true. Returning: ERR_OUT_OF_MEMORY
at: resize (./core/templates/cowdata.h:297) ERROR: Condition "err" is true. Returning: true at: push_back (./core/templates/vector.h:317)

Similar error found, but not resolved
https://github.com/godotengine/godot/issues/79555

Any tips to make it reproduceable or fixed are appreciated.

Baillie answered 22/10, 2023 at 18:45 Comment(0)
A
1

Baillie the actual game when launched via the editor takes 300mb

Why don't we see it in the profiler? Try to run the profiler for a long time and see how the memory behaves.

Concluding from the error messages, the crash happens when resizing an array by adding an element to it via push_back() call. It may or may not be from script's Array::push_back(), but it's worth investigating by eliminating all Array::push_back() calls as well as equivalent calls for packed arrays if you use any.

To isolate the problem, you may also try to run as little of the game as is enough to cause the leak. So eliminate bit by bit from the game as long as the thing persists.

Anaxagoras answered 22/10, 2023 at 21:26 Comment(0)
A
1

Baillie How is memory behaving in Godot's profiler in the long run? Are you creating a lot of stuff via scripts?

Anaxagoras answered 22/10, 2023 at 20:32 Comment(0)
B
0

Anaxagoras Nope, the profiler runs fine. I had memory leaks by instancing a lot of objects in a past project and the profiler/monitor did accuse that problem AFTER starting the game even in the editor, it does not behave abnormaly in here.

The first small peak is when loading a lobby, the second is starting the game and spawning a character. The exported version wont even open

Baillie answered 22/10, 2023 at 20:58 Comment(0)
A
1

Baillie You said editor version takes 1.4 gigs. We see only 85 megs in the profiler. What's with the rest?

Anaxagoras answered 22/10, 2023 at 21:12 Comment(0)
B
0

Anaxagoras My mistake! 1.4gb is the editor, the actual game when launched via the editor takes 300mb~.

But the exported version memory usage just goes up and up until it returns the error and closes.

Baillie answered 22/10, 2023 at 21:19 Comment(0)
B
0

This person had a problem with GLB files, wich i'm using, imported first from Blender and now Blockbench. Their problem was answered 3 weeks ago, and its said to be fixed in one of the branches, maybe I should just wait a bit for the next update to export it without errors or download the new branch?

https://github.com/godotengine/godot/issues/80431

Baillie answered 22/10, 2023 at 21:24 Comment(0)
A
1

Baillie the actual game when launched via the editor takes 300mb

Why don't we see it in the profiler? Try to run the profiler for a long time and see how the memory behaves.

Concluding from the error messages, the crash happens when resizing an array by adding an element to it via push_back() call. It may or may not be from script's Array::push_back(), but it's worth investigating by eliminating all Array::push_back() calls as well as equivalent calls for packed arrays if you use any.

To isolate the problem, you may also try to run as little of the game as is enough to cause the leak. So eliminate bit by bit from the game as long as the thing persists.

Anaxagoras answered 22/10, 2023 at 21:26 Comment(0)
B
0

Anaxagoras Thank you very much for your hel today. It does appear to be a problem with glTF files, the blender ones are 2.0, the BlockBench ones are not. I have a list where I preload everything I'll need to spawn quickly in the game, when disabling the player models, done in BlockBench, it launched, and I didn't un-preload the blender ones, the github call was right, something about bits of the saved file didn't go well with godot, probably because its not 2.0.

Again, thank you.

Baillie answered 22/10, 2023 at 21:59 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.