-
-
Notifications
You must be signed in to change notification settings - Fork 24.9k
SurfaceTool usage appears to leak #81953
Copy link
Copy link
Closed
Labels
Description
Godot version
4.1.1 stable
System information
Mac OS X 13.4.1 - M1
Issue description
It appears as if creating a new mesh instance using SurfaceTool seems consistently increase the memory usage of Godot.
Create a project (see below) where a new mesh instance is created over and over with a new surfaceTool copying from a CylinderMesh and it appears to ever increase the memory.
- I am using queue_free on the MeshInstance3D
- The other objects (SurfaceTool, CylinderMesh, the committed mesh) are refCounted so they should deallocate themselves without any intervention.
Steps to reproduce
Run the attached script
Minimal reproduction project
extends Node3D
var displayed: Node3D
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta):
print("going")
if displayed != null:
self.displayed.queue_free()
var cylinder = CylinderMesh.new()
cylinder.top_radius = 10.0
cylinder.bottom_radius = 9.0
cylinder.height = 40.0
cylinder.radial_segments = 200
var surfaceTool = SurfaceTool.new()
surfaceTool.begin(Mesh.PRIMITIVE_TRIANGLES)
surfaceTool.append_from(cylinder, 0, Transform3D())
surfaceTool.generate_normals()
var array = surfaceTool.commit()
surfaceTool.clear()
var meshInstance = MeshInstance3D.new()
meshInstance.mesh = array
self.add_child(meshInstance)
self.displayed = meshInstance
Reactions are currently unavailable