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

OpenCV leaks TLS data when terminating OS threads #109

Open
basvandijk opened this issue Jan 28, 2018 · 1 comment
Open

OpenCV leaks TLS data when terminating OS threads #109

basvandijk opened this issue Jan 28, 2018 · 1 comment

Comments

@basvandijk
Copy link
Contributor

The OpenCV C++ library uses Thread Local State (TLS). Unfortunately the TLS data is not freed when the OS thread terminates. See opencv/opencv#9745.

This is especially troublesome in Haskell where the runtime system by default executes FFI calls on random available OS threads. The user has no control over the lifetime of these OS threads which means there's a high risk of leaking OpenCV TLS data.

Until we find a solution in haskell-opencv we advise to do all OpenCV work on a bound Haskell thread (see forkOS or asyncBound) which ensures all FFI calls from that Haskell thread are done on the same OS thread. Then terminate these threads as little as possible.

Ping @ocharles, you might be suffering from this in production.

@emekoi
Copy link

emekoi commented Dec 12, 2019

this seems to have been solved in version opencv 3.4.

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