Hi,
Because of Object.to_mesh() i have a huge memory leak. :no:
I don’t know how to delete the generated mesh by Object.to_mesh() function. Like the documentation say, i have to delete this output.
i have try:
del mesh
i have try:
bpy.data.meshes.remove(mesh)
The both doesn’t works. The huge memory leak stay.
Thanks.
After some tests, the memory leak doesn’t come from to_mesh.
It’s come from the function :
mathutils.bvhtree.BVHTree.FromPolygons
I have post the bug here:
https://developer.blender.org/T50029
I have try in many way to fill the input arrays. The problem stay the same.
vertices = []
indices = []
for poly in mesh.polygons:
poly_indices = []
for loop_index in range(poly.loop_start, poly.loop_start + poly.loop_total):
vertex_index = mesh.loops[loop_index].vertex_index
poly_indices.append(vertex_index)
vertex = obj.matrix_world * mesh.vertices[vertex_index].co
vertices.append(vertex.xyz)
indices.append(poly_indices)
vertices = []
<b>for </b>v <b>in </b>mesh.vertices:
vertex = obj.matrix_world * v.co
vertices.append(vertex.xyz)
indices = []
<b>for </b>poly <b>in </b>mesh.polygons:
indices.append(poly.vertices)