Baking a geometry with 120K vertex count over a 1000 frames, I don’t believe the calculations done within the simulation zone are anything crazy. The size of the bake is ~2GB as you can see.
Nodes inside the sim zone
Transform
Set position
Raycast
Sample index/Sample nearest
Delete Geo
Store Attribute / Blur Attribute
Again, I don’t believe any of these are heavy, the total timing of the sim zone is only 20ms.
While baking, blender’s memory usage goes to 40+GiB (on a 32GB system). I could understand why during the bake it needs to use all that memory, but after the bake is done…it never clears and causes lag throughout the system.
I would expect this to clear automatically. Reopening the file clears this massive memory usage.
Additional Context
For context, this same file on fresh open takes <1GB memory, playing through the entire timeline to force the entire cache to load, memory usage is ~6GB.
There is nothing in this file that should use up 40Gigs of memory. I don’t believe it is some reporting error that shows the wrong memory usage, evidence that my entire PC slows down as expected when RAM is full.
Has anyone else encountered this?
Is there a way to clear memory without a file reopen?
Is this a bug? or something intentional?
Can you replicate it in a minimal example you can share?
Like, a file with just a 120k mesh and 1000 frames, that also results in 2GB bake and 40GB memory?
A common mistake is to do a geometry join from outside into a simulation zone. Every frame all geometry gets re-added and the vertex count grows linearly.
You should be seeing a cache in the Mb range, not the Gb range.
Debug by putting a viewer after the simulation zone and seeing if the vertex count is growing. If you cannot work around adding in geometry from outside, you can force a merge by distance at the end of the simulation zone.
Also, make sure you’re baking the right thing. Don’t bake realized geometry if you can help it. Rather bake the point-cloud.
Before I try to replicate and chase for the same results, If anyone else can confirm, on an existing project with sim zones, do they see the same behavior with baking and memory does not clear? If you need this file I can provide it.
No, this is not happening. My input Geo of 120k vertex stays 120k across the sim zone. I am however distributing points each frame (points, not vertex) and joining them with the previous frame. But these point also get deleted so the point cloud stays at a count of ~300
I am baking only the sim zone to disk. The 120k geometry is also baked before its fed into the sim zone. There are no instances for me to realize in the first place, so no Realize Instance in this file.
I believe the simulation bake is storing the complete mesh data for each frame, and 170k vertices with a couple attributes is a couple megs, so duplicating that 1000 times, it isn’t that far off from 2gb