Why is my object's constructor called so many times?

I have an actor that has a custom USceneComponent I made attached to it. placing a breakpoint in the constructor, I am seeing that the constructor is called many times.

I have read that UE4 does construction in a obscure way that causes it to construct multiple times, however, I am seeing a LOT of construction, and at times I wouldn’t expect it to occur.

Launch of the editor, constructor 5, destructor 1

Launching BP editor for my actor, constructor 1, destructor 0

Switching to the viewport, constructor 1, destructor 0

Closing the BP editor for my actor, constructor 0, destructor 0

Moving my actor in the level: constructor 1, destructor 0

Moving my scene component in the editor : constructor 1, destructor 0 (per frame?)

Additionally, I have a UProperty UStaticMeshComponent* that appears to be always null, each time the constructor is reached. The property has been set in the actor.

Is this normal behavior? Why? Why is the constructor called so many more times than the destructor?

Because constructors are useful in the editor, not only in-game, Unreal Engine tries to make sure your object is always updated according to its constructor.

Lets imagine an actor that has a vector with 3d widget, and a wall is stretched from the origin of your actor to that 3d widget. Now, lets assume you move this actor around in your world. Because construction is dependent on the location, unreal has to re-construct the object when you move.

So as far as i know, yes, it is normal behaviour. (But im not sure). It has been like this since at least 4.10.

Wouldn’t the lack of destructor calls indicate a memory leak? What is it doing with all these extra references to objects it is holding on to?

Well, again, i always thought unreal handled constructors a bit differently, like recalling them when an actor is updated instead of destructing/reconstructing them, but i never thought about the memory aspect of the subject, and to be honest, i have no clear answer to give here since my knowledge on how unreal is handling this is limited

However, i found this post that explains whats going on a lot better than i ever could, and i hope it can answer some of the questions you have:

https://forums.unrealengine.com/development-discussion/c-gameplay-programming/25162-why-are-con-de-structors-called-multiple-times-during-game-startup-and-shutdown