I am porting an image processing app using a camera developed by Android to IOS, and try to use C++ code used by Android in IOS.
Install the necessary library and link the target c++ code using objective-c wrapper.
The problem is that when a function with particularly large number of memory allocation/release ends in the C++ code, an error is definitely issued as the local variables are released.
Error:
Corrupt value: 0x3fc93ba18499360a
GBCare(20641,0x16bcfb000) malloc: *** set a breakpoint in malloc_error_break to debug
GBCare(20641,0x16bcfb000) malloc: Incorrect checksum for freed object 0x11556d1e0: probably modified after being freed.
Corrupt value: 0x3fc93ba18499360a
Additionally, the same error occurs sometimes at the location where the type of memory is allocated (e.g., cv::Mat.clone, cv:Mat::zeros) and we checked that the correct parameter was included.
I don't know what it means, but if you do it as shown in the picture below in Product-Scheme-Edit Scheme, it works normally without errors.
I think it's not a code problem, but a problem that occurs in the environment setting, so please help me.
Development environment: Xcode 13.2.1 / Swift5 / OpenCV 4.3