Hi,
I'm working on editor plugin. The important code does this: Each time the user clicks on MeshInstance, new Mesh is generated by SurfaceTool and it's set in MeshInstance.set_mesh(). The old resource is no longer in use and should be freed by engine. Quick look at Task Manager showed me that every time I click, 20-80 kB of data is allocated.
I'm sure the MeshInstance.set_mesh() is leaking because if I just generate new mesh and don't set it, no memory is leaking. Is there a way to force old mesh resource to free?
Important part of the code:
var newWireMesh = generateWireframeMesh(meshTool)
meshInstance.get_meta("orgMesh").surface_remove(0)
meshTool.commit_to_surface(meshInstance.get_meta("orgMesh"))
meshInstance.get_mesh().surface_remove(0)
meshInstance.set_mesh(newWireMesh)
The whole script is on Pastebin