Open3D
Open3D copied to clipboard
Memory Leak when add mesh to scene
trafficstars
Checklist
- [X] I have searched for similar issues.
- [X] For Python issues, I have tested with the latest development wheel.
- [X] I have checked the release documentation and the latest documentation (for
masterbranch).
Describe the issue
The memory usage constantly increases when a add a model, clear geometry, and re-add a new model to the OffscreenRenderer scene. Even if I recreate the OffscreenRenderer instance at each iteration, at a certain point, the memory leak starts again I appreciate any help.
Steps to reproduce the bug
import open3d as o3d
import csv
# main entry point
def main():
input_files = read_list_gltf('./list.csv')
render = o3d.visualization.rendering.OffscreenRenderer(512, 512)
render.scene.set_background([0.1, 0.2, 0.3, 1.0]) # RGBA
render.scene.show_axes(True)
vertical_field_of_view = 15.0 # between 5 and 90 degrees
aspect_ratio = 1 # azimuth over elevation
near_plane = 0.1
far_plane = 50.0
fov_type = o3d.visualization.rendering.Camera.FovType.Vertical
render.scene.camera.set_projection(vertical_field_of_view, aspect_ratio, near_plane, far_plane, fov_type)
# Look at the origin from the front (along the -Z direction, into the screen), with Y as Up.
center = [0, 0, 0] # look_at target
eye = [0, 0, 10] # camera position
up = [0, 1, 0] # camera orientation
render.scene.camera.look_at(center, eye, up)
for model_index, file in enumerate(input_files):
model = o3d.io.read_triangle_model(file)
render.scene.add_model(f'model', model)
# render to image code
# ....
# clear scene
render.scene.clear_geometry()
model = None
Error message
No response
Expected behavior
The update of the scene should not cause a memory leak.
Open3D, Python and System information
- Operating system: Windows 11 64-bit
- Python version: 3.9.7 (tags/v3.9.7:1016ef3, Aug 30 2021, 20:19:38) [MSC v.1929 64 bit (AMD64)]
- Open3D version: 0.15.1
- System architecture: x86
- Is this a remote workstation?: no
- How did you install Open3D?: pip
- Compiler version (if built from source): NA
Additional information
Memory usage after a few seconds
