Steven P. Goldsmith
Steven P. Goldsmith
They are hard to find, so I'd just build a program and run Valgrind on it to detect the native leaks. On Fri, Aug 4, 2023 at 8:53 AM brunohpg...
@nroduit My solution was not to use finalize period five years ago since it produces unpredictable code like calling GC does. I provided a work around hack. However, you are...
You are conflating JVM and native memory management principles and swapping one bad idea for another. See https://kylec32.medium.com/effective-java-avoid-finalizers-and-cleaners-7906bbd1cbb1 and my original post https://github.com/sgjava/opencvmem (It covered other classes besides Mat) Even...
I'll meet you half way. I made it so I could call free, but still use lazy finalize if memory was already deallocated. Just set the memory pointer to nil...
@nroduit I'm totally cool with allowing lazy cleanup if I have a way to take care of it myself real time. Lazy code should handle that automatically like I did....
That wasn't my opinion, it was a fact based on https://github.com/sgjava/opencvmem. You should see the irony in my laziness comment as the whole idea of finalize is lazy clean up...
@nroduit this doesn't fix all the other classes that leak (from my article I posted above): ```./org/opencv/video/KalmanFilter.java ./org/opencv/video/BackgroundSubtractorMOG2.java ./org/opencv/video/BackgroundSubtractor.java ./org/opencv/video/DenseOpticalFlow.java ./org/opencv/video/BackgroundSubtractorKNN.java ./org/opencv/video/DualTVL1OpticalFlow.java ./org/opencv/core/Algorithm.java ./org/opencv/calib3d/StereoMatcher.java ./org/opencv/calib3d/StereoBM.java ./org/opencv/calib3d/StereoSGBM.java ./org/opencv/features2d/FeatureDetector.java ./org/opencv/features2d/DescriptorMatcher.java ./org/opencv/features2d/DescriptorExtractor.java ./org/opencv/videoio/VideoCapture.java...
@nroduit PhantomReference Why It Can Be Considered an Antipattern: - Lazy Cleanup: If you rely on PhantomReference to manage critical resources, you depend on the garbage collector's unpredictable behavior. If...
@nroduit I believe you are missing the point. I'm simply pointing out that lazy cleanup especially of potentially large native objects is an antipattern. It doesn't really matter how you...
@nroduit I've done multiple PRs and they were rejected because the author thought Finalizers were the way to go. I've already pointed that out multiple times that lazy cleanup is...