Skip to content

Commit

Permalink
ADI: probably memory leak in ADI_UpdateStates
Browse files Browse the repository at this point in the history
The ADI_UpdateStates routine makes a copy of the AD_Input, but never destroyed that data after usage.  This could lead to memory continously getting allocated during a simulation with either ADI_C_Binding or the AD driver.
  • Loading branch information
andrew-platt committed Dec 3, 2023
1 parent a78fbc0 commit 96eb6b6
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions modules/aerodyn/src/AeroDyn_Inflow.f90
Original file line number Diff line number Diff line change
Expand Up @@ -228,10 +228,15 @@ subroutine ADI_UpdateStates( t, n, u, utimes, p, x, xd, z, OtherState, m, errSta
! Get state variables at next step: INPUT at step nt - 1, OUTPUT at step nt
call AD_UpdateStates(t, n, u_AD(:), utimes(:), p%AD, x%AD, xd%AD, z%AD, OtherState%AD, m%AD, errStat2, errMsg2); if(Failed()) return

call CleanUp()

contains

subroutine CleanUp()
!call ADI_DestroyConstrState(z_guess, errStat2, errMsg2); if(Failed()) return
do it=1,size(utimes)
call AD_DestroyInput(u_AD(it), errStat2, errMsg2); if(Failed()) return
enddo
end subroutine

logical function Failed()
Expand Down

0 comments on commit 96eb6b6

Please sign in to comment.