Skip to content

Fix memory leaks - #134

Open
jschueller wants to merge 2 commits into
modelon-community:masterfrom
jschueller:leak
Open

jschueller wants to merge 2 commits into
modelon-community:masterfrom
jschueller:leak

Conversation

@jschueller

@jschueller jschueller commented Jun 30, 2026 •

Copy link
Copy Markdown
Contributor
  • Cache one SUNContext per module for arr2nv helpers instead of one per vector
  • Give IDA/CVode/KINSOL a persistent sun_ctx, freed in __dealloc__
  • Free temp contexts/vectors on all success and error paths
  • Use N_VDestroyVectorArray for sensitivity vectors, free scales,
    nonlinear solvers, and stale objects on re-init
  • Use new SUN_CSC_MATH enum

- Cache one SUNContext per module for arr2nv helpers instead of one per vector
- Give IDA/CVode/KINSOL a persistent sun_ctx, freed in __dealloc__
- Free temp contexts/vectors on all success and error paths
- Use N_VDestroyVectorArray for sensitivity vectors, free scales,
  nonlinear solvers, and stale objects on re-init
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.

1 participant