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

**URL:** <https://forums.unrealengine.com/t/crash-in-protobuf-3-21-x-repeated-string-field-destructor-on-ios-related-to-ue5-fstring-tarray/2643610>\
**Category:** C++\
**Tags:** xcode-ios, ios-ipa, unreal-engine, iOS, question\
**Created:** [August 16, 2025, 8:39am UTC](https://forums.unrealengine.com/t/crash-in-protobuf-3-21-x-repeated-string-field-destructor-on-ios-related-to-ue5-fstring-tarray/2643610 "2025-08-16T08:39:47Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![user\_4c20e2e76d3730c3768a5eadefcfd2990dcf3cd0f856136e8f4b85](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@user\_4c20e2e76d3730c3768a5eadefcfd2990dcf3cd0f856136e8f4b85](https://forums.unrealengine.com/u/user_4c20e2e76d3730c3768a5eadefcfd2990dcf3cd0f856136e8f4b85)\
**Post date:** [August 16, 2025, 8:39am UTC](https://forums.unrealengine.com/t/crash-in-protobuf-3-21-x-repeated-string-field-destructor-on-ios-related-to-ue5-fstring-tarray/2643610/1 "2025-08-16T08:39:47Z")

</div>

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**

```auto
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?
