Repository navigation
Port memory leak and bad free fixes from superlu PR #180 to base files - #3
Merged
Merged
Conversation
Mirror xiaoyeli/superlu#180 (Fix memory leaks and bad frees) in the precision-generic templates so future extractions carry the fixes: - SRC/xgsisx.base, SRC/xgssvx.base: free the MC64 permutation, the permuted matrix AC and the SLU_NR copy AA on the early returns taken for the lwork == -1 memory query and for a singular factorization. - EXAMPLE/xlinsolx*.base: release the L and U SuperMatrix stores when the factors live in a user-supplied work[] array; xlinsolx2 no longer calls Destroy_SuperNode_Matrix/Destroy_CompCol_Matrix on work[] storage. - TESTING/xdrive.base: always destroy the factors xgssv allocated, free the previous factors before xgssvx refactors with DOFACT or SamePattern, and destroy the work[] stores inside the loop instead of once at the end. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VjnVBdsXEM3c41ssQ3hFAM
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Mirrors xiaoyeli/superlu#180 (Fix memory leaks and bad frees) in the precision-generic templates, so that future extractions of the s/d/c/z sources carry the same fixes.
ACand theSLU_NRcopyAAon the early returns taken for thelwork == -1memory query and for a singular factorization.LandUSuperMatrix stores when the factors live in a user-suppliedwork[]array.xlinsolx2no longer callsDestroy_SuperNode_Matrix/Destroy_CompCol_Matrixonwork[]storage.xgssvallocated, free the previous factors beforexgssvxrefactors withDOFACTorSamePattern, and destroy thework[]stores inside the loop instead of once at the end.The AddressSanitizer CI job added by the upstream PR has no counterpart in this repository and is not included.
Verification
The
extracttool was not available, so the templates were checked by diffing each template's change, with@(pre)substituted byd, against the upstream PR's diff of the corresponding double-precision file. Six of seven match byte for byte;TESTING/xdrive.basediffers only in a comment, where the upstream PR itself used "allocated the factors itself" inddrive.cand "allocated the factors" insdrive.c,cdrive.candzdrive.c. The template uses the latter wording.Generated by Claude Code