Fix native memory leaks#2511
Open
thatcomputerguy0101 wants to merge 7 commits into
Open
Conversation
mcm001
reviewed
May 30, 2026
| // dont do refinement on small markers | ||
| if (halfWindowLength < 4) continue; | ||
| var halfWindowSize = new Size(halfWindowLength, halfWindowLength); | ||
| var ptsMat = new MatOfPoint2f(cornerPoints); |
Contributor
There was a problem hiding this comment.
Should this variable be made class scope and reused instead?
This comment goes for everywhere we see "new mat*" inside of functions
Contributor
Author
There was a problem hiding this comment.
Doing so would affect the thread safety of calling the methods that use the class variable. I'm not sure if this is a real concern for any of our classes though.
Contributor
There was a problem hiding this comment.
All of our pipes and pipelines should* only be called by a single thread. Or that was the design intent at least
(Asterisk for some very specific parts of camera calibration. TryFinishCalibration is called from a web server thread)
14f8c3b to
5710f34
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This fixes the many native memory leaks of OpenCV's matrixes. While I can't guarantee I got everything, it is substantially better than it was. The test results are now a lot cleaner.
Meta
Merge checklist: