# Non-UObject pointers in a UObject class

**URL:** <https://forums.unrealengine.com/t/non-uobject-pointers-in-a-uobject-class/287987>\
**Category:** Programming & Scripting\
**Tags:** unreal-engine\
**Created:** [July 11, 2014, 10:19pm UTC](https://forums.unrealengine.com/t/non-uobject-pointers-in-a-uobject-class/287987 "2014-07-11T22:19:37Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![tginick](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@tginick](https://forums.unrealengine.com/u/tginick)\
**Post date:** [July 11, 2014, 10:19pm UTC](https://forums.unrealengine.com/t/non-uobject-pointers-in-a-uobject-class/287987/1 "2014-07-11T22:19:37Z")

</div>

I have been reading up on how the garbage collector works in UE4 and I just wanted to clarify a few things.

Since non-UObject pointers cannot be decorated with UPROPERTY, I’m guessing memory management for these kinds of objects will just be handled by the programmer with new and delete. Is this the case?

I read in another question that TSharedPtr/TSharedRef/TWeakPtr classes are supposed to be used for non-UObjects. Does this mean that one should just never use a plain pointer in a UObject class? Thanks!

---

<div class="post-metadata">

**Author:** ![Rama](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/rama/32/882413_2.png) [@Rama](https://forums.unrealengine.com/u/Rama)\
**Post date:** [July 12, 2014, 3:00am UTC](https://forums.unrealengine.com/t/non-uobject-pointers-in-a-uobject-class/287987/2 "2014-07-12T03:00:07Z")

</div>

Dear Tginick,

You are entirely responsible for memory management of data that is below the UObject subsystem level!

I use plain pointers all the time. My entire custom HUD animation system is pure C++ and plain pointers and new and delete all over the place, you can see the results in these videos!

> **[Introducing my Victory HUD Elements System! Dynamic HUD System With Animation](https://forums.unrealengine.com/showthread.php?12837-Introducing-my-Victory-HUD-Elements-System%21-Dynamic-HUD-System-With-Animation)**
>
> Dear Community, I am very happy to finally introduce you to my own personal Animated HUD System! With my system I can: -Add Text, Spinning Images, and more at any time from any blueprint. All of the various visual Elements come from a common base...

If you are going to do your own memory management I suggest checking out my wiki tutorial on the subject

#Dynamic Memory Management in UE4

> **[A new, community-hosted Unreal Engine Wiki](https://forums.unrealengine.com/t/a-new-community-hosted-unreal-engine-wiki/141494)**
>
> After over a year in maintenance mode, the official Unreal Engine Wiki is now permanently offline. These resources now live on a new community-run Unreal Engine Community Wiki — ue4community.wiki! You will be able to find content from the official...

---

<div class="post-metadata">

**Author:** ![tginick](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@tginick](https://forums.unrealengine.com/u/tginick)\
**Post date:** [July 12, 2014, 3:16am UTC](https://forums.unrealengine.com/t/non-uobject-pointers-in-a-uobject-class/287987/3 "2014-07-12T03:16:35Z")

</div>

Awesome answer. Thank you! 🙂
