Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Shapes using a Dictionary to store data leak memory #929

Closed
jbromberg opened this issue Aug 6, 2024 · 4 comments
Closed

Shapes using a Dictionary to store data leak memory #929

jbromberg opened this issue Aug 6, 2024 · 4 comments
Labels
bug Something that isn't working as intended severity:minor Small impact on functionality or usability topic:runtime Concerning runtime behavior (or its source code)

Comments

@jbromberg
Copy link

jbromberg commented Aug 6, 2024

Certain collision shapes have memory leaks originating from the Dictionary that is used to store their data. The simple script below illustrates the problem:

extends Node

# Leaks
func _process(delta):
	for i in 1000:
		var cap := CapsuleShape3D.new()

# Doesn't leak
func _process(delta):
	for i in 1000:
		var box := BoxShape3D.new()
@github-actions github-actions bot added the needs triage Something that needs investigation label Aug 6, 2024
@mihe
Copy link
Contributor

mihe commented Aug 6, 2024

I don't have the ability to test this for myself right at this moment, but do you see the same behavior if you use Godot Physics?

@jbromberg
Copy link
Author

There is no leak using Godot Physics

@mihe
Copy link
Contributor

mihe commented Aug 7, 2024

It turns out this was a bug in the godot-cpp GDExtension bindings, which was fixed a few months back.

I am not able to reproduce this on latest master of this extension, which I guess more or less confirms this, since I haven't really changed much about how these particular Dictionary are used.

This also means that this issue has been fixed in 0.13.0-beta1, and will similarly be fixed in the upcoming 0.13.0-stable, which should hopefully be out shortly after Godot 4.3-stable is released.

@mihe mihe closed this as completed Aug 7, 2024
@mihe mihe added bug Something that isn't working as intended topic:runtime Concerning runtime behavior (or its source code) severity:minor Small impact on functionality or usability and removed needs triage Something that needs investigation labels Aug 7, 2024
@mihe mihe changed the title Shapes using a Dictionary to store data leak memory Shapes using a Dictionary to store data leak memory Aug 7, 2024
@mihe
Copy link
Contributor

mihe commented Aug 15, 2024

0.13.0-stable has just been released, which includes the fix for this.

Note that the release in the Godot Asset Library is still pending approval as of typing this, so you might need to download it from the link above.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something that isn't working as intended severity:minor Small impact on functionality or usability topic:runtime Concerning runtime behavior (or its source code)
Projects
None yet
Development

No branches or pull requests

2 participants