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

Calling keep() produces memory leak in Python #3164

Closed
krejov100 opened this issue Jan 28, 2019 · 3 comments
Closed

Calling keep() produces memory leak in Python #3164

krejov100 opened this issue Jan 28, 2019 · 3 comments
Assignees
Labels

Comments

@krejov100
Copy link
Contributor

D400, OS independent, PC/UpBoard, Python

This is an issue that follows up to the following merged pull request #1015. There needs to be a mechanism added to handle the release of the data once its use is finished with. I am not able to find a python call to release said kept frame, resulting in a severe memory leak which garbage collection is not able to handle. Having looked through rs_frame.hpp, I believe there needs to be a corresponding call to rs2_release_frame which is currently done in the C++ destructor.

@lramati
Copy link
Contributor

lramati commented Jan 30, 2019

I can't recreate this behavior.

import pyrealsense2 as rs

pipe = rs.pipeline()
pipe.start()

df = rs.decimation_filter()

while (True):
    f = pipe.wait_for_frames()
    f.keep()
    d = f.get_depth_frame()
    if d:
        f2 = df.process(d)
        f2.keep()

stabilizes memory-wise at < 50MB on both Python 2 and Python 3.6 in debug and release modes

@dorodnic
Copy link
Contributor

@krejov100 - I'd like to double check the issue is real before merging #3174
Perhaps frames are being queued somewhere else in your project?

@krejov100
Copy link
Contributor Author

Yep so I found the issue was in fact pickling the numpy array. Numpy recently had a regression in 1.16.0
numpy/numpy#12793
reverting to 1.15.4 means I no longer see memory leaks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants