Do I need to manually manage memory of a struct pointer?

The engine manages the memory of anything that derives at UObject. I wonder if the engine also manages pointer structs.

FMyStruct * struct = new FMyStruct();

For example, I declare my struct like this. As I recall my professor told us when using C++ every time you called “new” to instantiate an object you must, later on, delete it afterward to avoid memory leaks. structs do not inherit from UObject so it brings me to the question of “Do I need to manually manage the memory of a struct pointer?”

Yes, but generally speaking you don’t really create pointers to structs in UE4 - or use new at all really.

I’m using 4.25 and I’ve been trying to expose some of the struct values in the blueprint. it always returns null which is very odd. So My workaround is to create struct pointers and dereference it to get the exact value in the blueprints.

You should study more about the reflection system.
I can’t even remember anymore the last time I had to use “new” and “delete” (if not for sharables on Slate).

I refactored my code removing dynamically allocated struct pointers. The problem I’m having is I did not pass by reference when passing it as a parameter. so the actual value is not really modified that is why it appears to be null. I kinda feel stupid now. lol. anyways, Thanks for the help. :slight_smile: