Crash in Protobuf 3.21.x repeated string field destructor on iOS, related to UE5 FString/TArray

Hello,

I’m working in an Unreal Engine 5.3.2 environment with Protobuf 3.21.12, and I’m investigating an issue where a crash occurs only on iOS in the destructor of a repeated string field.

Current Setup

  1. LocalPlayer TMap
TMap<FString, FRealStruct> PlayerData;
  • FRealStruct has FString GetString() const;
  • The TMap is populated at login time
  1. UI ListView
  • Items are created with NewObject<UMyItem> and added to the ListView
  • Each item stores UPROPERTY() FMyStruct MyStruct;
  • The currently selected item is stored as UPROPERTY() UMyItem* MyItem;
  1. Packet Preparation
  • Retrieve a TMap value, make a deep copy via FString Temp(MyString)
  • Add it to a static TArray
  • Convert the TArray into std::vector<std::string> and assign to the Protobuf message’s repeated string field
  • The message itself is created as a stack variable
  1. Issue
  • Even without sending the packet, a crash occurs in the message’s destructor
  • The crash happens only on iOS; it does not occur on Windows/Android
  • Tried Arena messages, heap allocation, assign via temporary vectors, etc. — all result in the same crash

Additional Information

  • Whether returning const FString& or FString, the same issue occurs
  • LocalPlayer TMap, ListView Items, and the static TArray could potentially be accessed concurrently (multithreading involved)
  • The root cause is suspected to be a conflict between the Protobuf repeated string destructor and UE FString/TArray internal buffer, or iOS-specific allocator behavior
  • If the TMap’s memory is corrupted, it seems plausible that the crash would manifest only on iOS

Questions

  1. Is it reasonable to assume that the crash occurring only on iOS is due to a conflict between the Protobuf repeated string destructor and UE FString/TArray memory management?
  2. When copying a TMap value’s FString into a TArray and then assigning it to a repeated string, what is the recommended pattern to ensure no shallow copy occurs and it is handled safely?
  3. Given that I must use Protobuf 3.21.x, is there a way or design pattern to safely use repeated string on iOS without crashes?
  4. Are there any references to known cases of iOS crashes with repeated string (documentation, GitHub issues, Google Groups discussions) that you can point me to?