Skip to content

fix allocation-deallocation mismatch on etaart in analysis_protostar_environ - #877

Merged
danieljprice merged 1 commit into
danieljprice:mainfrom
hex-0x0:fix-discRM-etaart
Sep 15, 2026
Merged

danieljprice merged 1 commit into
danieljprice:mainfrom
hex-0x0:fix-discRM-etaart

Conversation

@hex-0x0

@hex-0x0 hex-0x0 commented Sep 15, 2026 •

Copy link
Copy Markdown
Contributor

Description:
in analysis_protostar_environ.F90, the primary subroutine do_analysis allocates etaart once per dump, but the deallocate was at the end of subroutine doanalysisRPZ, which do_analysis calls once per sink. With two or more sinks the second call reads etaart after it has been freed. therefore, moved the deallocate to the end of do_analysis to match the allocate.

Components modified:

  • Setup (src/setup)
  • Main code (src/main)
  • Moddump utilities (src/utils/moddump)
  • Analysis utilities (src/utils/analysis)
  • Test suite (src/tests)
  • Documentation (docs/)
  • Build/CI (build/ or github actions)

Type of change:

  • Bug fix
  • Physics improvements
  • Better initial conditions
  • Performance improvements
  • Documentation update
  • Better testing
  • Code cleanup / refactor
  • Other (please describe)

Testing:
Ran with multiple sinks, did not segfault now.

Did you run the bots? no

Did you update relevant documentation in the docs directory? no

Did you add comments such that the purpose of the code is understandable? no

Is there a unit test that could be added for this feature/bug? no

If so, please describe what a unit test might check:

Related issues: Closes #854

Summary by CodeRabbit

  • Refactor
    • Adjusted internal resource cleanup timing after analysis and sink processing.

@coderabbitai

coderabbitai Bot commented Sep 15, 2026 •

Copy link
Copy Markdown

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Advanced

Run ID: d8f1d451-0180-4989-a321-0e30b1e2d7f0

📥 Commits

Reviewing files that changed from the base of the PR and between eb7e459 and d806636.

📒 Files selected for processing (1)
  • src/utils/analysis_protostar_environ.F90

Included review availability: Your plan provides up to 2 included reviews per hour; 1 remains after this review.


📝 Walkthrough

Walkthrough

The change moves deallocate(etaart) from doanalysisRPZ to do_analysis. The deallocation now occurs after the over_sinks loop completes.

Changes

etaart lifecycle

Layer / File(s) Summary
Move etaart cleanup after sink processing
src/utils/analysis_protostar_environ.F90
doanalysisRPZ no longer deallocates etaart. do_analysis deallocates it after the over_sinks loop.

Priority: ⬇️ Low

Estimated code review effort: 1 (Trivial) | ~2 minutes

Change: Bug fix

Suggested reviewers: danieljprice

Merge Risk: ⚪ Minimal · up to d8066

No merge-blocking risk remains; subsequent sink processing can complete before etaart is freed.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 0…
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly identifies the allocation-deallocation mismatch for etaart in analysis_protostar_environ. It accurately summarizes the primary bug fix.
Description check ✅ Passed The description explains the bug, identifies the affected component and change type, records multi-sink testing, answers the template questions, and links issue #854.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@danieljprice

Copy link
Copy Markdown
Owner

Thanks for fixing this, very much appreciated

@danieljprice
danieljprice merged commit c74b76b into danieljprice:main Sep 15, 2026
270 checks passed
@hex-0x0
hex-0x0 deleted the fix-discRM-etaart branch September 15, 2026 18:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug in analysis_protostar_environ.F90 for discRM analysis with 2 sinks

2 participants