Skip to content

Chemistry species entries of flux_src_n are allocated but never deallocated #1907

Description

@sbryngelson

m_rhs.fpp allocates the per-species entries of flux_src_n under if (chemistry), but the finalize block never deallocates them.

Allocationsrc/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

Finalizes_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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions