godotengine / godot

Godot Engine – Multi-platform 2D and 3D game engine
https://godotengine.org
MIT License
89.19k stars 20.22k forks source link

Memory leak and crash when creating custom shapes for ShapeCast #97308

Open mcmino opened 4 hours ago

mcmino commented 4 hours ago

Tested versions

Reproducible in 4.3 stable and 4.2.2 stable

System information

Godot v4.3.stable - macOS 14.6.1 - GLES3 (Compatibility) - Apple M1 Pro - Apple M1 Pro (8 Threads)

Issue description

Attempting to create a Convex or Concave PolygonShape2D makes Godot freeze, until a memory error appears when reaching 86 GB of memory used for Godot, which keeps going up if the app is not forced to quit. This doesn't occur when selecting any of the premade shapes.

The only error I found on the logs that may be related are the following:

ERROR: 1 RID allocations of type 'P12GodotShape2D' were leaked at exit.
USER WARNING: 1 RID of type "CanvasItem" was leaked.
   at: _free_rids (servers/rendering/renderer_canvas_cull.cpp:2483)
USER WARNING: ObjectDB instances leaked at exit (run with --verbose for details).
   at: cleanup (core/object/object.cpp:2284)
USER ERROR: 1 resources still in use at exit (run with --verbose for details).
   at: clear (core/io/resource.cpp:604)

Steps to reproduce

  1. Create a ShapeCast2D
  2. For the Shape field, click a Convex or Concave PolygonShape2D

I tested this on an empty project and was able to reproduce just as in my other projects

Minimal reproduction project (MRP)

N/A

matheusmdx commented 4 hours ago

I can't reproduce this issue

https://github.com/user-attachments/assets/c7283f3e-ed2d-4a59-aad6-0d4546df94e6

Godot v4.3.stable - Windows 10.0.19045 - Vulkan (Forward+) - dedicated AMD Radeon RX 580 2048SP (Advanced Micro Devices, Inc.; 31.0.21916.2) - AMD Ryzen 5 3600 6-Core Processor (12 Threads)

mcmino commented 2 hours ago

Example of the problem in MacOS:

https://github.com/user-attachments/assets/3b714fce-4971-44a3-904e-1c944b501639

Might be OS specific, because just tried on Linux Ubuntu without issue, with this setup: Godot v4.3.stable - Ubuntu 24.04 LTS 24.04 - Wayland - GLES3 (Compatibility) - Mesa Intel(R) HD Graphics 5500 (BDW GT2) - Intel(R) Core(TM) i5-5200U CPU @ 2.20GHz (4 Threads)