--enable-sanitizer finds memory leaks
Running a basic galaxy setup with the following config:
./configure --with-hydro=sphenix --with-kernel=quintic-spline --disable-hand-vec --enable-mpi=no --enable-debugging-checks=yes --enable-optimization=no --enable-debug=yes --enable-compiler-warnings=yes --enable-sanitizer
../../../../swiftsim/swift --self-gravity --hydro --threads=12 params_original.yml (edited)
with files included, and latest version of master will result in a crash. This same issue has been pertinent in other runs, especially when trying to use moving_mesh_SF.
Current fix to this is to iterate via gcount_j not gcount_padded_j in runner_doiact_grav.c, line 626 in Master. This prevents segfaults in more customised ICs with gcounts not divisible by 8 and with variable mass as is common in moving mesh.
Segfault will happen in
if (gparts_j[pjd].time_bin == time_bin_not_created && mass_j != 0.f) { error("Found an extra gpart in the gravity interaction");
Line 658 in runner_doiact_grav.c when trying to access gparts_j[pjd], since pjd is the iterable of gcounts_padded_j not gcounts_j.
To my current (and perhaps limited) understanding, iterating using gcounts_padded_j is the issue, one that is affecting moving mesh, as it has a variable number of cells with varying mass, by construction.