Very slow get_tree().quit() on Release version

Godot Version

4.4

Question

For some reason quitting my game on Release version takes time - totally freezing the application for a 3-4 seconds. On Debug version it’s totally instant and behaves as expected. Is this a bug or a feature? Any idea what could be wrong?

This usually happens if Godot tries to release allocated objects that were not properly freed before exiting. For example, instantiating classes using .new() without freeing them afterward.
Try running your export from the command line with the --verbose parameter to find out which objects are likely leaking.

3 Likes

Thank you for your help. I did as you suggested and this is the list of stuff that leaks on exit. I’m not sure how to make sense of it and find the nodes or shaders or “P11JoltShape3D” objects which haven’t been freed. Do you have any advice for me?

ERROR: 6 RID allocations of type 'P11JoltShape3D' were leaked at exit.
ERROR: Pages in use exist at exit in PagedAllocator: N33RendererSceneRenderImplementation22RenderForwardClustered32GeometryInstanceSurfaceDataCacheE
   at: ~PagedAllocator (./core/templates/paged_allocator.h:170)
ERROR: Pages in use exist at exit in PagedAllocator: N33RendererSceneRenderImplementation22RenderForwardClustered32GeometryInstanceForwardClusteredE
   at: ~PagedAllocator (./core/templates/paged_allocator.h:170)
ERROR: 1 shaders of type SceneForwardClusteredShaderRD were never freed
   at: ~ShaderRD (servers/rendering/renderer_rd/shader_rd.cpp:899)
ERROR: 2 RID allocations of type 'N10RendererRD11MeshStorage4MeshE' were leaked at exit.
ERROR: 1 RID allocations of type 'N10RendererRD15MaterialStorage8MaterialE' were leaked at exit.
ERROR: 1 RID allocations of type 'N10RendererRD15MaterialStorage6ShaderE' were leaked at exit.
ERROR: 3 RID allocations of type 'N10RendererRD14TextureStorage7TextureE' were leaked at exit.
ERROR: 1 RID allocations of type 'N17RendererSceneCull8InstanceE' were leaked at exit.

Okay, I spent 2 hours trying to pinpoint the leaks, while I only needed to delete Terrain3D node from my main scene. I’m gonna notify the developer/discord.

1 Like