m_rhs.fpp allocates the per-species entries of flux_src_n under if (chemistry), but the finalize block never deallocates them.
Allocation — src/simulation/m_rhs.fpp, in s_initialize_rhs_module:
if (chemistry) then
do l = eqn_idx%species%beg, eqn_idx%species%end
@:ALLOCATE(flux_src_n(i)%vf(l)%sf(...))
end do
Finalize — s_finalize_rhs_module deallocates three ranges:
eqn_idx%mom%beg : eqn_idx%E, under viscous .or. surface_tension .or. heat_conduction
eqn_idx%E alone, under the chem-diffusion condition
eqn_idx%adv%beg : eqn_idx%adv%end
eqn_idx%species%beg : eqn_idx%species%end is never freed.
Every chemistry run leaks num_species full 3-D fields sized over idwbuff, plus their GPU device mappings. It is a shutdown-time leak, so it will not show up as growth during a run, but it does matter for anything that initializes and finalizes the RHS module more than once, and it is wrong on principle.
Found while adding Fourier heat conduction (#1906); unrelated to that change and present on master.
m_rhs.fppallocates the per-species entries offlux_src_nunderif (chemistry), but the finalize block never deallocates them.Allocation —
src/simulation/m_rhs.fpp, ins_initialize_rhs_module:Finalize —
s_finalize_rhs_moduledeallocates three ranges:eqn_idx%mom%beg : eqn_idx%E, underviscous .or. surface_tension .or. heat_conductioneqn_idx%Ealone, under the chem-diffusion conditioneqn_idx%adv%beg : eqn_idx%adv%endeqn_idx%species%beg : eqn_idx%species%endis never freed.Every chemistry run leaks
num_speciesfull 3-D fields sized overidwbuff, plus their GPU device mappings. It is a shutdown-time leak, so it will not show up as growth during a run, but it does matter for anything that initializes and finalizes the RHS module more than once, and it is wrong on principle.Found while adding Fourier heat conduction (#1906); unrelated to that change and present on
master.