I have a similar problem。
I Build a plugin as static lib use in unreal 4.2.1. have used google proto buf
use xcode 9.4
and crash On the iphone A12 CPU series. like XR, XS Max
Got a lot of Log :
LogMemory: Warning: Attempting to free a pointer we didn’t allocate!
i check the code. protobuf generate .h files and include inline function use delete. it likes this delete will be use FMemory::Free()
so.i add c++ flag -fno-inline-functions to rebuild lib. it’s no log any more
next I Got a Crash. Dump Stack is std::basic_string::~basic_string()
It’s a struct member function that returns std::string
definition : std::string ToString() const;
implement :
std::string tagCSHead::ToString() const {
std::stringstream oss;
oss << "CSHead"
<< ", crypto_type: " << crypto_type
<< ", compression_type: " << compression_type
<< ", pkg_size: " << pkg_size
<< ", version: " << (uint16_t)version
<< ", msg_type: " << (uint16_t)msg_type
<< ", flag: " << (uint16_t)flag
<< ", cmd: " << cmd
<< ", seq: " << seq
<< ", session_id: " << session_id
<< ", service_name_size: " << (uint16_t)service_name_size
<< ", service_name: " << service_name
<< ", target: " << target
<< ", data_size: " << data_size;
return oss.str();
}
printf("send internal, cshead:%s", a_stCSHead.ToString().c_str());
it will print right log and then crash…
then i test sprintf .then it works…
std::string tagCSHead::ToString() const {
char szBuff[4096];
sprintf(szBuff, "CSHead, crypto_type: %u, compression_type:%u, pkg_size:%u, version:%u, msg_type:%u, flag:%u, cmd: %u, seq:%u, session_id:%llu, service_name_size:%u, service_name:%s, target:%u, data_size:%u"
, crypto_type, compression_type, pkg_size, (uint16_t)version, (uint16_t)msg_type, (uint16_t)flag, cmd, seq, session_id, (uint16_t)service_name_size, service_name, target, data_size);
return szBuff;
}
so …I Guess it Should be related to the implementation of std::stringstream
or Xcode stl library conflicts with A12?