Hair Niagara Simulation does not use appropriate memory

I’ve been looking at a memory issue regarding the physics Niagara simulation of hair grooms, we’ve noticed that sometimes new hair niagara sims might use parameters of a previous groom, in this case we had a hair groom with a lot of guides, making for a very high memory usage. After this was created, subsequent niagara sims might use the properties of this large hair groom, which causes a massive memory spike for us (as we use a lot of hair grooms).

I found that the main issue is that the EmitterData’s Runtime Allocation Estimate in FNiagaraEmitterInstanceImpl would sometimes retain this information, it seems to me that the EmitterData is shared amongst all instances of the StableSpringsEmitter, meaning all hair component’s niagara sims use the same Runtime Allocation Estimate, which in our case means subsequent hair sims of large grooms also create a large AllocationSize. I found resetting the estimate when it is too different from input data resolves the issue, however this does not feel like an actual fix, as there are sims that will use the estimate size.

Any insights here?

[Attachment Removed]

Hi, I just had a quick look and it seems that the versionned EmitterData is shared across all the assets and when an instance is released the buffer is not shrinking. A EmitterData->ClearRuntimeAllocationEstimate((uint64)this) in the FNiagaraEmitterInstanceImpl could potentially fix it. I am going to check with the niagara team if there is a better solution or not since i don’t know the history and will come back to you. Thanks for reporting the issue.

Michael

[Attachment Removed]