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

Memory leak due to removed_stracks #328

Open
pavelbugneac opened this issue Apr 6, 2023 · 2 comments
Open

Memory leak due to removed_stracks #328

pavelbugneac opened this issue Apr 6, 2023 · 2 comments

Comments

@pavelbugneac
Copy link

Hi!

There seems to be a memory leak coming from removed_stracks.

self.lost_stracks.extend(lost_stracks)
self.lost_stracks = sub_stracks(self.lost_stracks, self.removed_stracks)
self.removed_stracks.extend(removed_stracks)

In bytetrack.py, the self.removed_stracks variable increases without limit. Over time this can lead to running out of RAM memory if we run inference on larger videos or rtsp streams. This also in turn makes tracking inference speed slower over time, since sub_stracks function loops over all elements of self.removed_stracks. There is already an open pr with a suggested solution #249 which ive tested and it works well. Could you either approve or add your own solution to this?

Thank you.

@Vladimir-125
Copy link

I have noticed the same issue! Because it keeps all the removed_stracks it seems that Python keeps references to the KalmanFilter computation matrixes as well. Which quickly adds up to use a huge portion or memory!

@ghost
Copy link

ghost commented Aug 5, 2023

see how ultralytics handle this problem:
https://github.com/ultralytics/ultralytics/blob/main/ultralytics/trackers/byte_tracker.py#L291
Perhaps the author keep all the removed_stracks for other purposes, after all, it is for academic study.

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

No branches or pull requests

2 participants