Gravity cache size increase leads to crash
Bug uncovered by @Roduit and @yvesrevaz.
When the gravity cache of a tread is too small and it gets reallocated, the code crashes in gravity_cache_clean()
while freeing the old arrays. It's unclear why this happens. The caches are purely thread-local as they are carrier by the runner
object. They are originally allocated by the main thread in engine_config()
but that should not matter.
Yves seems to have also caught it crash in gravity_cache_zero_output()
.
This is not seen in normal operations as the caches never grow since they are allocated to be the size of a leaf cell. The new sink particle scheme creates a lot of particles and will thus ask for a cache reallocation on occasion. Bug likely been there forever but just never triggered.