Skip to content

[2.6.6] calib3d_Calib3d_findChessboardCornersSB_10 Method cause HUGE memory leak #212

Description

@soimy

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.

Activity

  1. changed the title [-]calib3d_Calib3d_findChessboardCornersSB_10 Method cause HUGE memory leak[/-] [+][2.6.6] calib3d_Calib3d_findChessboardCornersSB_10 Method cause HUGE memory leak[/+] on May 28, 2025
  2. EnoxSoftware commented on May 28, 2025

    @EnoxSoftware
    Owner

    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

  3. soimy commented on May 29, 2025

    @soimy
    Author

    Unity version: LTS 2022.3.29f1
    OpenCVforUnity: 2.6.6
    Editor Platform: MacOS Sequoia 15.5 on M4 mini

    Image

    But when I use memory profiler, untrack memory amount is way smaller, but still at a rapid growth over time.

    Image
  4. EnoxSoftware commented on May 30, 2025

    @EnoxSoftware
    Owner

    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.

    Image

    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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions