Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

killed due to memory leak in OffscreenRenderer #6791

Open
3 tasks done
spookycouch opened this issue May 14, 2024 · 0 comments
Open
3 tasks done

killed due to memory leak in OffscreenRenderer #6791

spookycouch opened this issue May 14, 2024 · 0 comments
Labels
bug Not a build issue, this is likely a bug.

Comments

@spookycouch
Copy link

spookycouch commented May 14, 2024

Checklist

Describe the issue

I am running an application where the OffscreenRenderer is created in a function, and the function is called multiple times.

The renderer itself is run headless on a CPU.

Using top, I was able to observe that the memory use of the application increases each time a new renderer is created and an image is rendered, and memory does not appear to be freed even when the scope of the function/loop is left. The memory usage steadily grows with each function call until there is no available memory and the python script is killed.

This appears to be the same issue in #5596, and the workaround is to create and run the renderer in a multiprocessing Process such that memory is de-allocated once the process exits.

I was able to reproduce the bug consistently in a for-loop below with the env EGL_PLATFORM="surfaceless":

Steps to reproduce the bug

import open3d as o3d
for _ in range(100):
    cloud = o3d.geometry.TriangleMesh.create_box(0.1,0.1,0.1)
    render = o3d.visualization.rendering.OffscreenRenderer(1000,1000)
    material_record = o3d.visualization.rendering.MaterialRecord()
    render.scene.add_geometry("hi", cloud, material_record)
    rgb = render.render_to_image()
    del cloud
    del render
    del material_record
    del rgb

Error message

[Open3D INFO] EGL headless mode enabled.
FEngine (64 bits) created at 0x7fccd0298f40 (threading is enabled)
EGL(1.5)
OpenGL(4.5)
Killed

Expected behavior

No memory leaks - memory should be freed when the scope of the renderer is exited.

Open3D, Python and System information

- Operating system: Ubuntu 20.04
- Python version: Python 3.8.10
- Open3D version: 0.18.0
- System architecture: x86_64
- Is this a remote workstation?: no
- How did you install Open3D?: pip

Additional information

The suggestion to use a shared renderer in #4480 is not applicable in this case as the function is called on a server (multi-threaded) and renders images of arbitrary width/height

@spookycouch spookycouch added the bug Not a build issue, this is likely a bug. label May 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Not a build issue, this is likely a bug.
Projects
None yet
Development

No branches or pull requests

1 participant