x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

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
 {
     GENERATED_USTRUCT_BODY()
 
     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.

Product Version: UE 4.12
Tags:
more ▼

asked Jul 22 '16 at 02:22 PM in Bug Reports

avatar image

vebski
100 9 11 14

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

4 answers: sort voted first

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

more ▼

answered Jul 22 '16 at 06:20 PM

avatar image

ImVawx ♦♦ STAFF
6.8k 114 18 128

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

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.

more ▼

answered Jul 25 '16 at 08:06 PM

avatar image

ImVawx ♦♦ STAFF
6.8k 114 18 128

avatar image vebski Jul 25 '16 at 10:23 PM

Hi Kyle,

Thanks for response! :) 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 ;)

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

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
 {
     GENERATED_USTRUCT_BODY();
 
     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;
 };
 
 UCLASS()
 class AH456878_API ATaskActor : public AActor
 {
     GENERATED_BODY()
     
 public:    
     ATaskActor();
     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:

alt text

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

https://wiki.unrealengine.com/Structs,_USTRUCTS(),_They're_Awesome

456878_bp.png (80.3 kB)
more ▼

answered Jul 22 '16 at 03:12 PM

avatar image

ImVawx ♦♦ STAFF
6.8k 114 18 128

avatar image vebski Jul 22 '16 at 03:16 PM

Hi,

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

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

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.

more ▼

answered Jul 22 '16 at 05:30 PM

avatar image

ImVawx ♦♦ STAFF
6.8k 114 18 128

avatar image vebski Jul 22 '16 at 05:54 PM

Hi Kyle,

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. Edit3:

 int32 basicArray[400000];

This crashes as well...

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question