I am adding functionality to an existing Cocoa application, written primarily in Objective-C. I have to use the existing C ++ class in the class I am writing, so the new Objective-C ++ class. Also, I had to write a method in a C ++ class that temporarily uses a buffer. So my C ++ method is similar to
(void) myMethod{ int8_t* bffr = new int8_t[length];
I am instantiating a C ++ class in a .mm file and trying to continue. The problem is that the application crashes. However, if I comment on delete
, the application does not crash, but the tools report a leak associated with this method. I assume Objective-C memory management is getting bolluxed up. How to enable this catch-22?
By the way, I get the same result using malloc and get_temporary_buffer.
source share