[2.6.6] calib3d_Calib3d_findChessboardCornersSB_10 Method cause HUGE memory leak
Tested in ArUcoCameraCalibrationExample project
When use Chessboard Type and enable useFindChessboardCornersSBMethod(which is true by default), huge memory leak in profiler(around 1G per frame).
After tracking down the csharp code. The API causing this is calib3d_Calib3d_findChessboardCornersSB_10 from dllImport.
Thank you for your reporting.
Could you tell me the environment you tested? Unity version : OpenCVforUntiy version : Editor Platform :
Which Category is significantly increased in the profiler? https://docs.unity3d.com/2021.3/Documentation/Manual/ProfilerMemory.html
Unity version: LTS 2022.3.29f1 OpenCVforUnity: 2.6.6 Editor Platform: MacOS Sequoia 15.5 on M4 mini
But when I use memory profiler, untrack memory amount is way smaller, but still at a rapid growth over time.
Thank you very much for your detailed report.
We were able to reproduce the issue on our environment (Silicon Mac / arm64) as well. When useFindChessboardCornersSBMethod is enabled and the calib3d_Calib3d_findChessboardCornersSB_10 function is used, the Unity profiler shows a significant increase in Native memory usage — approximately 1GB per frame.
However, when running the same code on an Intel Mac (x86_64), we did not observe a continuous increase in Allocated Memory Distribution under Native memory. The behavior appears stable on that architecture.
Additionally, we analyzed the memory usage using Xcode’s Instruments tool, and as shown in the attached screenshot, no significant memory leaks were detected.
It’s currently unclear whether this discrepancy is due to a Unity profiler bug specific to the arm64 architecture or caused by some other factor, but we will continue investigating the issue.