Editor and it's garbadge

I making a game where player can shoot. Player shoots bullets (as Actors), thay fly away, damages enemies and disappears, everything nice, but “objs” number, you know, stats (FPS, Delay, Memory, Objs) in top right corner which i turned on from editor preferences. Usually this number is around 35k. But when i’am firing for 30 seconds this number goes up to 80k and not falling down until relaunch! I have really high fire rate… So why i’am scared: memory. After 3-4 hours of relaunches, spawning actors, doing other instancing mess i hit 50k objs, 1,300 MB memory (450 MB on editor start) and 54-th PlayerPawn. In my game shooting - is frequently action. After 30 minutes number of Objs will be around million, thier garbadge will eat 500-600 MB of memory. Looks like my game workability will depend on time of playing and in one fine hour memory will end up…
Is that okay?

Most likely the problem might be that you dont destroy the “bullets” you are spawning.Destroy the “bullet” actor or try setting a lifetime value.

Ockert.

I’am destroying actors. Actors counter is shows correct number. But even if bullets are destroyed, objs is not going down. It is like i need to destroy their components before deleting actor, but there is garbage collector that should do this for me.

Can you provide a screenshot ?

Why don’t you simply make a line trace to check the target of the bullet, so that you don’t spawn any actor ?

Because of partilce systems. Each bullet has a particle system. But it is possible to pre-spawn some particle systems… That’s a good idea, but this question is actually about garbadge in memory :slight_smile:

Just launched editor (recompiled it as developement, possibly it was DebugGame) and quickly pressed play button.

Then fired for about 1 minute.

Then opened photoshop to edit pics, got back to game (still playing) where memory is OK, Objs are way less than before O_o

Wait a minute… Today, 10 hours before (possibly in DebugGame compile) garbadje collector hadn’t worked… Wut? Well, Objs are gone, but the memory is still being filled with something. And i have BP_Player4 pawn right now. It is like there is already BP_Player 1, 2 and 3, but they was in previous launches. They dissapears only when i restart editor. Changing level is not changes anything.