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)
The whole script is on Pastebin