Video memory getting filled with unused textures?
I'm running a project that spawns a bunch of static meshes of cars. Each of these cars has a dynamic material used for paint (from the Automotive materials pack) so they can all have random paint colors.
Now, when I spawn all the cars in a level blueprint, then let the level run then completely reload the level (with a call to the Load Level node) everything works fine. I can run this process as long as I want.
However, to get a performance increase (and increase the size of the level) I stopped reloading the level when I want different car meshes spawned and instead call the Get All Actors of Class node, loop through all the cars and destroy them. I then call the process that respawns all the cars. This also works, but after about 10-15 cycles of this, the project crashes, popping up a window that says "Out of video memory trying to allocate a texture!"
Do I need to explicitly delete all the dynamic materials created when spawning the cars somehow? This whole thing feels like garbage isn't being collected if I don't reload the full level (which I'd rather not have to do).
Any help will be appreciated, thanks!
asked Apr 12 '18 at 08:34 PM in Rendering
In an attempt to figure out what was filling up the memory to cause my crash, I added a blueprint call to execute the memreport console command. Now I no longer get memory overflow crashes and no indication of what was going wrong in the memory report. As soon as I remove the memreport command, I get out of memory crashes again. So this call clearly does something. (Crash message below)
So my problem is gone, but I don't understand why. My best guess is that asking for the memory report forced garbage collection that wasn't happening earlier.
Leaving this open since I have no idea why the memory issue stopped. Thanks!
Follow this question
Once you sign in you will be able to subscribe for any updates here