iOS16 has a bug that operator new/delete override will fail, see:
To figure out why the crash happens, you need to check whether the std::string’s memory allocation and free occur in the same way.
We found a case that std::string’s allocation is in the libc++.1.dylib, and the destructor is inlined in the main executable which use UE’s allocator. Because os iOS16 operator new/delete will fail, so the allocation in the libc++.1.dylib will not use UE’s allocator, so the mismatch happens, and the app crashed.
The solution could be:
- replace the usage of std::string to FString
- Use Ansi or Binned1 allocator on iOS. Allocator Binned1 checks PtrIsOSMalloc() and will not free memory allocated by OS.