Actors in PIE can't handle big TInlineAllocators

I am currently trying to write cache friendly agent system. And I am not sure if this is a bug or works as intended but if I have an Actor placed on scene that consists of

TArray<FMainTask, TInlineAllocator<65536>> MainTask;

where FMainTask is

USTRUCT(BlueprintType, Blueprintable)
struct FMainTask

	int64 as1;
	int64 as12;
	int64 as13;
	int64 as14;
	int64 as15;

Game will crash if I start it in PIE inside of UObjectProperty::EmitReferenceInfo. However if I start just the game from VS everything seems to work fine.

Is this a bug or am I missing something about about TInlineAllocator?

ps. Dropping numbers to ~16k in allocator or getting rid of it and spawning ~65k structs and adding to array works fine.

Hey vebski,

When it comes to the TinlineAllocator, I am getting a compiling error telling me that it is not supported in TArray Properties. With that in mind, I would simply not use the TInlineAllocator and rely on the dynamic property of TArray.

Furthermore, I am able to create this class:

#pragma once

#include "GameFramework/Actor.h"
#include "TaskActor.generated.h"

USTRUCT(BlueprintType, Blueprintable)
struct FMainTask

	UPROPERTY(EditAnywhere, BlueprintReadWrite)
	int as1;
	UPROPERTY(EditAnywhere, BlueprintReadWrite)
	int as12;
	UPROPERTY(EditAnywhere, BlueprintReadWrite)
	int as13;
	UPROPERTY(EditAnywhere, BlueprintReadWrite)
	int as14;
	UPROPERTY(EditAnywhere, BlueprintReadWrite)
	int as15;

class AH456878_API ATaskActor : public AActor
	virtual void BeginPlay() override;
	virtual void Tick( float DeltaSeconds ) override;

	UPROPERTY( EditAnywhere, BlueprintReadWrite, Category="Task")
	TArray<FMainTask> MainTask;

I can then make a Blueprint child class with this logic, to fill the array with 65536 elements:

Finally, here is more information on using USTRUCT( ):



TArray with TInlineAllocator does not work with UPROPERTY().
For easy bug reproduction create

  TArray<AActor*, TInlineAllocator<16000000>> ActorList;

This line should crash your editor if you press PIE. Do not put UPROPERTY() above it.
Seems like issue is not connect to Structs but to TInlineAllocator not being able to handle big sizes in PIE.

Edit: I tested this line on different PC and it crashes not only while PIE but also on saving the map. Crash is still in UObjectProperty::EmitReferenceInfo

Hey vebski,

When you are using the TInlineAllocator with such a large number, you are hitting an assert. This is a way for the code to tell you that what you are doing is not what is expected. In the case here, the number you are using is out of a range that is expected.

As for the Crash Reporter coming up when you are in PIE, this is also normal behavior, as it is showing you the line at which the assert is happening.

Because of this, I recommend not using such large numbers with your TInlineAllocator.


This seems like rather not intended behavior. Its crashing because editor seems to have issues with handling objects that have big memory offsets. As soon as I start shipped game issue disappears and I can fit millions of items with TInlineAllocator.

What unexpected is about big memory allocations? It’s nothing unusual especially in games that try to simulate huge amounts of objects.
If in fact this is desired behavior this should be better communicated by code/warnings and documentations. It makes usage of this allocator bit pointless.

Edit: I just run a test and this thing gets worse

AActor* actorList[2000000];

PIE crashes if I create class with simple C++ array that has 2mil pointer (!). I can’t see how this is a feature… Seems like any pre-allocation of bigger memory in ANY class will crash editor.

Edit2: Seems like 200 000 pointers in simple array is enough to crash editor.

int32 basicArray[400000];

This crashes as well…

Thanks for the feedback, the issue has been logged as, UE-33680.

Hey vebski,

The developer(s) got back to me regarding this issue and it is a known limitation of the Garbage Collection system in UE4, which is why the Assert( ) exists. This also means that this is a issue that wont be fixed.

The largest amount assumed for any array is 1048575.


Thanks for response! :slight_smile: Could you also verify that this issue exists only in Editor? In game it seems like I still have no such issue. If so, I will just get around it with #ifdefs.

I would like just to verify this as editor issue since in game I can get to ridiculous pre-allocated size on UObject (2.5gbs). And since there is not documentation on it your knowledge is only source :wink: