# UE 5.5.2.0 Crash in FStateTreeCompiler::CreateBindingsForNodes due to garbage memory access

**URL:** <https://forums.unrealengine.com/t/ue-5-5-2-0-crash-in-fstatetreecompiler-createbindingsfornodes-due-to-garbage-memory-access/2432732>\
**Category:** C++\
**Tags:** editor-crash, unreal-engine, state-machines, crash, CPP\
**Created:** [March 31, 2025, 7:09pm UTC](https://forums.unrealengine.com/t/ue-5-5-2-0-crash-in-fstatetreecompiler-createbindingsfornodes-due-to-garbage-memory-access/2432732 "2025-03-31T19:09:13Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![brain56](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@brain56](https://forums.unrealengine.com/u/brain56)\
**Post date:** [March 31, 2025, 7:09pm UTC](https://forums.unrealengine.com/t/ue-5-5-2-0-crash-in-fstatetreecompiler-createbindingsfornodes-due-to-garbage-memory-access/2432732/1 "2025-03-31T19:09:14Z")

</div>

Sharing about a crash we spotted in the State Tree compiler code, specifically in `FStateTreeCompiler::CreateBindingsForNodes`.

If you add enough bindings in your state tree, eventually, you’ll hit a 100% reproducible crash in this function. The function takes a `TArrayView<FInstancedStruct> Instances`. This function call `CreatePropertyFunctionsForStruct` within the `CreateBindingsForNodes` can then reallocate `FStateTreeCompiler::SharedInstanceStructs`.

When `CreateBindingsForNodes` is called in `FStateTreeCompiler::CreateStateTransitions`, the parameter passed into the function is `SharedInstanceStructs`, which is then used to initialize a `TArrayView`, which later on will be viewing an outdated version of `SharedInstanceStructs` because of the reallocation, triggering the garbage memory crash.

The fix for this would be updating the function signature from:

```auto
bool FStateTreeCompiler::CreateBindingsForNodes(TConstArrayView<FStateTreeEditorNode> EditorNodes, FStateTreeIndex16 NodesBegin, TArrayView<FInstancedStruct> Instances)

```

into

```auto
bool FStateTreeCompiler::CreateBindingsForNodes(TConstArrayView<FStateTreeEditorNode> EditorNodes, FStateTreeIndex16 NodesBegin, TArray<FInstancedStruct>& Instances)

```

where the `Instances` parameter is instead a `TArray<FInstancedStruct>&`.

---

<div class="post-metadata">

**Author:** ![EmkyuNQ](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@EmkyuNQ](https://forums.unrealengine.com/u/EmkyuNQ)\
**Post date:** [June 19, 2025, 1:28pm UTC](https://forums.unrealengine.com/t/ue-5-5-2-0-crash-in-fstatetreecompiler-createbindingsfornodes-due-to-garbage-memory-access/2432732/2 "2025-06-19T13:28:37Z")

</div>

We are currently experiencing a similar issue in Unreal 5.5.2 with the State Tree Compiler.

The State Tree Compiler can sporadically make the editor crash. It happens for any State Tree Asset using a lot of binded properties, especially bindings using property functions.  
Moreover, it can prevent the cook of the project, as the State Tree Compilation sometimes break and needs manual recompilation.

 ![image_2025-06-19_140208481](https://d3kjluh73b9h9o.cloudfront.net/original/4X/b/b/1/bb1a06ddf84011caeb6c64b2bd85f4ac6742dfca.png)  
 ![image (5)](https://d3kjluh73b9h9o.cloudfront.net/original/4X/c/5/8/c58369bd425ed57484d27a4fcf337ce11ca80dff.png)

This issue was partially solved by replacing the `FStateTreeCompiler::CreateBindingNodes` signature from

> bool FStateTreeCompiler::CreateBindingsForNodes(TConstArrayView EditorNodes, FStateTreeIndex16 NodesBegin, TArrayView Instances)

to

> `bool FStateTreeCompiler::CreateBindingsForNodes(TConstArrayView<FStateTreeEditorNode> EditorNodes, FStateTreeIndex16 NodesBegin, TArray<FInstancedStruct>& Instances)`

as suggested by @brain56.

However, making the changes makes any `FStateTreePropertyRef` unusable. Pointers to State Tree Parameters seems to break. This is noticeable while performing a `FStateTreeRunEnvQueryTask`, where the Parameter binded for the result is not updated.

Has anyone suggestions on how to solve this ?

---

<div class="post-metadata">

**Author:** ![James.Keeling](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@James.Keeling](https://forums.unrealengine.com/u/James.Keeling)\
**Post date:** [July 16, 2025, 2:17pm UTC](https://forums.unrealengine.com/t/ue-5-5-2-0-crash-in-fstatetreecompiler-createbindingsfornodes-due-to-garbage-memory-access/2432732/3 "2025-07-16T14:17:36Z")

</div>

Hello everyone!

I had this thread brought to my attention, and I have great news! This is indeed a bug and was fixed as part of 5.6. It did not make it into a 5.5 hotfix as it had a header change for the function. You can find the relevant changes made on our GitHub. Here is a direct link to the commit for those interested: [StateTree: Fixed crash during bindings compilation (accessing view to array under modification).](https://github.com/EpicGames/UnrealEngine/commit/3d4499812dbfceec93a7c9eee183a63530dad4a4)

Thank you for bringing these issues to our attention. I hope this can help unblock you and any other users on 5.5.

-James
