0 votes

Having some trouble finding a lost scene or script (or two) that I hadn't properly freed before exiting the game.

Was wondering if anyone had any debugging tips for finding them, since the exit will crash and the console says nothing.

in Engine by (5,192 points)

Normally this is not something that should cause a problem, Godot manage the memory for you. Still, it should not crash, just create memory leaks. Are you able to reproduce the issue with a minimal project?

Unfortunately, I've been as successfully at recreating it as finding the resources causing it.

It seems to be something to do when a character fires a bunch of bullets. Afterwards if you try to close the program it will hang up and crash.

I thought I would ask if anyone knows of a way to inspect resources at exit in a debug build, because otherwise I'll have to rewrite a few thousand lines of code, rebuilding along the way.

3 Answers

+1 vote

In a command line, navigate to the folder which contains your project.godot file.

Then, still via that command prompt, launch the Godot executable with the '-v' parameter.

If executed correctly, Godot will automatically start running your game (regardless of whether you have an Editor instance open) and it will include debug output. This includes a moderate amount of information about leaked resources on exit.

It won't tell you where the leak occurred but it will tell you what's leaking.

by (101 points)
+1 vote

I found that you can enable logging and enable the verbose flag (my releases were having issues that my dev env wasn't). Note GDScript is not garbage collected per the docs

Logging and verbose stdout mode can be enabled by searching Project Settings. If you are debugging a release then you can export with debug mode in the export panes. The log file can be found by Project > Open Project Data Folder

by (16 points)
0 votes

Those answers given are good suggestions for debugging verbosely from the console, and useful for finding most resource leaks.

In the case of this old issue there wasn't anything I could find in the output, and had to resolve it be attaching a debugger to the source and doing a lot of probing to track down the offending scripts. Eventually the problem reoccurred and hit one of my break points. I don't remember the exact issue too well anymore.

by (5,192 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.