fix: free tau_Re_vf in all viscous runs, not only cyl_coord#1398
fix: free tau_Re_vf in all viscous runs, not only cyl_coord#1398sbryngelson wants to merge 1 commit intoMFlowCode:masterfrom
Conversation
Claude Code ReviewHead SHA: dcb8a72 Files changed:
FindingsMemory management:
The - if (cyl_coord) then
- do i = 1, num_dims
- @:DEALLOCATE(tau_re_vf(eqn_idx%cont%end + i)%sf)
- end do
- @:DEALLOCATE(tau_re_vf(eqn_idx%E)%sf)
- @:DEALLOCATE(tau_re_vf)
- end if
+ do i = 1, num_dims
+ @:DEALLOCATE(tau_re_vf(eqn_idx%cont%end + i)%sf)
+ end do
+ @:DEALLOCATE(tau_re_vf(eqn_idx%E)%sf)
+ @:DEALLOCATE(tau_re_vf)Per CLAUDE.md: "Conditional allocation MUST have conditional deallocation." The matching |
|
The fix is correct. The allocation of if (viscous) then
@:ALLOCATE(tau_Re_vf(1:sys_size))
do i = 1, num_dims
@:ALLOCATE(tau_Re_vf(eqn_idx%cont%end + i)%sf(...))
end do
@:ALLOCATE(tau_Re_vf(eqn_idx%E)%sf(...))
...
end ifThe old code had the deallocation incorrectly nested inside |
ⓘ You've reached your Qodo monthly free-tier limit. Reviews pause until next month — upgrade your plan to continue now, or link your paid account if you already have one. |
|
Warning Rate limit exceeded
To continue reviewing without waiting, purchase usage credits in the billing tab. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Automated Code ReviewSummary: No issues found. ✅ Verified:
Minimal, correct fix. Safe to merge. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #1398 +/- ##
==========================================
+ Coverage 64.75% 64.77% +0.01%
==========================================
Files 71 71
Lines 18721 18717 -4
Branches 1551 1550 -1
==========================================
Hits 12123 12123
+ Misses 5640 5637 -3
+ Partials 958 957 -1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Summary
Fixes #1366.
In
s_finalize_rhs_module,tau_Re_vfis allocated insideif (viscous)but was only deallocated insideif (cyl_coord). Any Cartesian viscous run (viscous = .true.,cyl_coord = .false.) leaked alltau_Re_vfhost and GPU allocations.The fix removes the erroneous
if (cyl_coord)guard — the deallocation is already inside theif (viscous)block, so no additional condition is needed.Change
src/simulation/m_rhs.fpp: drop theif (cyl_coord) then ... end ifwrapper around the threetau_re_vf@:DEALLOCATEcalls.Test plan
if (viscous)guard)