Memory Leak

I have been having memory leak issues with UE4 since Ive been using it. Which was around Nov. of 2015, version 4.10 I believe. I always thought it was my computer, which it still might be. /shrug

Anyways, when using the editor for blueprint scripting, opening and closing blueprints, raise the memory use of the editor. I know this by using windows task manager and looking at the process tab. The memory use only goes up. After closing blueprints in the editor the memory doesn’t drop. Once it goes up it doesn’t go back down.

When opening my player character BP along with one of my AI characters BP the initial use of memory goes up. Should I close both of those the memory doesn’t drop. But should I reopen them, the memory does go up but not nearly as much.

So If on start up of the editor the memory use of UE4 editor is at around 2 gigs. If I open 1 blueprint (BP), the memory use goes to around 2.1 gigs. On the second BP the memory use goes up to around 2.2 gigs. If I close both BPs the memory doesn’t drop. It stays at 2.2 gigs. Should I reopen 1 BP again the memory might creep up to 2.22 gigs. On the 2nd BP, memory use may bump to 2.24 gigs. Again on closing those the second time, the memory use of UE4 doesn’t decrease.

This gets even worse when I play my level in a new editor window (see Note below on mobile preview, and standalone game), PIE. Upon playing the level in PIE the memory use of UE4 jumps up, the longer I play in PIE, the higher the memory goes. Once I close down PIE the memory use stays where it is. So if on the first time playing my level in PIE, lets say the memory use jumps to 3 gigs. After playing a few minutes the memory might be around 4 gigs.

After PIE has closed the memory stays pretty much where it was when it closed. Unless I open and close blueprints etc. On a second launch of PIE, the memory jumps up again, creeps up during play, stays about where it was when I closed the second instance of PIE.

So, on first use of PIE, memory use goes to 3gs, play for a few mins, close it, memory might be near 4gs. Stays at 4gs or so. Go into PIE a second time, memory jumps to 5gs, play a few mins memory use might be around 7gs at closing and stays there till I open a third PIE and so on…

After doing this several times, eventually my RAM is at its max (16gs). At this point my computer is pretty much at a stand still. I close UE4, if I can, and eventually the process for UE4 will turn off. This can take several minutes. Usually I’m to impatient to wait so I go into task manager and stop the process manually. Which still can take a few moments to clear out of memory.

Now after my long text of explanation, I hope you get the idea.

Is this issue something I can rectify on my computer, could it be something in my games BP logic that stays in memory, or could this be an editor bug?

Thanks for your time!

~

NOTE:
When playing my level using either mobile preview or the standalone game modes memory use of UE4 editor does not rise (well it does creep ever so slow, but I think that’s due to having BPs open, or maybe even just clicking on and off the edit window.). Either of these modes use about 1.3gs worth of memory. The memory goes up to that point, stays there during playing of the level, then on closing of these modes, the memory use for these processes goes away. Since they are closed.

The memory use for UE4 editor window stays pretty much where it is during these modes. But opening and closing of BPs still effect UE4 editor process memory use which is seperate from these other 2 mode processes.

Oh, the process memory of UE4 editor when using a new edit window, PIE, does increase on a fresh project like a third person project. Just at a slower rate.
Which I’m guessing is because there just isn’t as much going on in a fresh project vs my game level with all kinds of actors, materials and such.

~

One note, UObjects can be explictly deleted, they will be garbage collected when they not refrenced anywhere where reflection system can see. So don’t expect memory won’t drop right away when you close things.

UObjects can be deleted in blueprint? Heh I’m not sure what that even is.

Ill look into that. Thanks.

~

This issue still exists in 4.12.

The memory buildup seems a bit less for each use of the new editor window (PIE), but it is still there.

~

and to this day in 4.27 it is the same. Open blueprints I spike unreal from 1.8 gb to 5 gb of ram, just by opening it and closing it, I don’t get the mem back. Just by opening it up and closing it a few times with loading things inside the blueprints can spike up to 7gb, at this time I’m out of ram. Close blueprints editor, it’s still 7gb, delete mesh off the screen, still 7gb. If you have a heavy load like a heavy mesh loaded into the blueprint class it will waste ram and once you close it, the ram just stays there locked inside unreal, doing nothing, you don’t get it back. You can’t use blueprints if you are on 8 gb of ram when you have a large mesh, acceptable is you close blueprints and you get the same ram usage before you opened the blueprint editor with the mesh inside the blueprint viewport. I can’t believe no one did anything to solve this problem. I haven’t tried 5 yet, but I’m thinking it has the same problem ? This happens with meshes from C++ class also but at a lower level, drag a class onto the screen that has a large mesh and it will take first about 1 gb, delete the mesh off the screen, you don’t get back anything, load it again, it will eat some more, eventually you go up towards your ram limit if you are on 8gb. My guess the ram just stays there inside the system doing nothing at all, it never gets flushed. Is there at least any manual way to flush the ram ? This is what I call an unoptimized system.

some computers have control panels which can force a cleanup of the ram. check your computer manual see if there is something like that included. they usually look like bloatware pieces of software, sometimes they are, easy to miss them if you don’t know they are included.

here is how it works on my computer, before hitting the free memory button

01

then after a couple of seconds

02

these are apps create by the computer manufacture or maybe the mother board manufacture. probably there are third party apps but I can’t recommend any of those, have no experience with them

comes with the drivers for the mainboard ? I don’t think I have that. But maybe there are utilities made for this I’m thinking made by others maybe. I should search for those, as long as it does not crash my unreal editor. You would have to alt tab all the time to flush it like a toilet I guess, but that would not bother me. What should I search for anyway on line, memory flusher ? Memory cleaner. Why I avoid blue prints, one of the reasons, since I have large meshes with half a milion vertex points or even larger for terrain.

you have a custom computer? what motherboard you have?

you need something like this

that looks like for msi motherboard chipset, I have asus. Will have a look.