-
Notifications
You must be signed in to change notification settings - Fork 566
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
[BUG] VideoCapture does not release unmanaged resources on dispose - Memory Leak. #900
Comments
i can confirm this behavior still exists, when using same code on emgucv & opencvsharp for camera access emgucv used around 8gb-10gb memory before gc hit while opencvsharp stays at 100-200mb for my project. I am using avalonia as frontend with dotnet 8. |
The leak happens in Open CV C++ and can be reproduced using Open CV Python. It will need to be fixed on the Open CV side.
|
Referencing Open CV ticket here: opencv/opencv#13255 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Describe the bug
When opening and connecting to a webcam device using the VideoCapture all works fine until you need to stop using the camera and dispose of the VideoCapture object.
The dispose runs fine and the managed code is removed from the heap however the private bytes remain.
If a new instance of VideoCapture device is used then the private bytes of the process increases consistently (by about 20mb or so each time).
Video Capture Disposal is the only method to stop the exclusive lock on the webcam.
** OS / Platform **
Windows 11
** .Net version **
.Net Core 7 / 8
CPU Architecture
x86_64
** Emgu CV package used**
nuget package
Emgu.CV 4.8.1.5350
Emgu.runtime.windows.msvc.rt.x64 19.37.32825
To Reproduce
By execution 150 the process memory (as reported by visual studio) is circa 2gb.
Expected behavior
Memory usage to remain reasonably constant when connecting and disconnecting from webcam.
The text was updated successfully, but these errors were encountered: