Search Unity

ParticleSystem memory overhead

Discussion in 'Editor & General Support' started by dogmahtagram, Jul 31, 2014.

  1. dogmahtagram

    dogmahtagram

    Joined:
    Dec 9, 2013
    Posts:
    1
    I'm running Unity 4.3.1 and just noticed what appears to be a massive memory overhead when using the new ParticleSystem rather than the legacy particle emitter, animator, and renderer components. Using ParticleSystems appears to significantly increase Scene Memory in the profiler.

    I just ran a test, building two "particle systems" that display a single snowflake with animating color. One system was created by adding an ellipsoid emitter, animator, and renderer to a game object. The other was created with a single ParticleSystem component on another game object. The two systems result in particles that are visually identical.

    I then profiled two scenes, each with 30 instances of one of these test systems.

    Here's the Scene Memory snapshot from the legacy system:
    upload_2014-7-31_13-50-47.png

    And here's the snapshot from the scene using ParticleSystems:
    upload_2014-7-31_13-51-16.png

    Notice nearly a 300k increase in scene memory when using the ParticleSystem objects?

    That 300k increase jumps to a 30 meg increase in our actual game which implements many simultaneous "particle systems".

    I haven't had any luck researching memory overhead of the new ParticleSystem component, so I'm curious if anyone else has knowledge to share..?

    Why is there such a massive overhead?

    Switching all our particles back to the legacy system will take considerable time, hence I'm hoping that there's just something I'm overlooking as to the optimization of ParticleSystems.

    Thanks for any insight!
     
  2. r2digi

    r2digi

    Joined:
    Sep 26, 2013
    Posts:
    24
    running into the same here.....we are ended up with 50-70mb or ParticleSystem usage in ours....going to ave to find way to cut that way down :(
     
  3. BrianND

    BrianND

    Joined:
    May 14, 2015
    Posts:
    82
    I've noticed this also on the 5.3.6f1. I have a pooling system and it's taking nearly 30-40mb to keep instances alive.
     
  4. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    Particle systems allocate the amount you specify as Max Particles in the particle system. To reduce memory you would cap this amount. If it only spawns a few, don't allocate the default thousand. 30 x 1000 = 30,000 obviously, so this is going to be 30,000 times https://docs.unity3d.com/ScriptReference/ParticleSystem.Particle.html

    I haven't tested this, but it seems logical enough.
     
    nxtboyIII likes this.
  5. r2digi

    r2digi

    Joined:
    Sep 26, 2013
    Posts:
    24
    with more testing and profiling even a basic particle system with only a few particles set is going to take a lot of memory. much more than expected. we switched some things that we were using particle systems for to fixed animations instead to save some space. be care of using particle systems when you don't really need to and if you have to use them with lots of instances of them.
     
  6. BrianND

    BrianND

    Joined:
    May 14, 2015
    Posts:
    82
    Thanks it did help a bit hippocoder. I found out it's also because the use of mesh vertex based emitters. I guess it has to store that info but I don't see why it can't be shared amongst instances. I also noticed a bug where even if you switch the emitter type to a shape based one it still allocates memory for the vertex based emitter. It doesn't clear that reference on the serialised object. I'll file a bug for those.
     
  7. BrianND

    BrianND

    Joined:
    May 14, 2015
    Posts:
    82
    Actually it looks like even the most simple particle will use 8.9kb per instance.
     
  8. LightStriker

    LightStriker

    Joined:
    Aug 3, 2013
    Posts:
    2,717
    47.4Kb per instance in 2018.3.0. Even when the system is set to a max of 25 particles.
     
    SolarFalcon likes this.
  9. mitaywalle

    mitaywalle

    Joined:
    Jul 1, 2013
    Posts:
    247
  10. mat108

    mat108

    Joined:
    Aug 24, 2018
    Posts:
    131
    Anyone know if this is still an issue or has it been addressed
     
  11. brockemon

    brockemon

    Joined:
    Dec 21, 2012
    Posts:
    48
    Bump, also looking into this. Have a bunch of particle systems in our object pool taking up 50MB memory on mobile devices.
     
  12. valentin56610

    valentin56610

    Joined:
    Jan 22, 2019
    Posts:
    156
    This is still an issue, spawning a bunch of spheres throws errors about my computer running out of RAM
    Seriously? I just got like 200 mesh spheres....
     

    Attached Files: