Skip to content

Fix for memory leak#272

Merged
joshfactorial merged 2 commits into
developfrom
fix/trinuc-slice-offbyone
May 3, 2026
Merged

Fix for memory leak#272
joshfactorial merged 2 commits into
developfrom
fix/trinuc-slice-offbyone

Conversation

@joshfactorial
Copy link
Copy Markdown
Collaborator

@joshfactorial joshfactorial commented May 3, 2026

Found some lists that were being written, but the code was refactored so that the lists were never actually used. Could cause a small memory leak, so they were removed.

…pend

sample_trinucs returns the center (mutated) position, but the trinuc slice
was starting at that position rather than one before it, so trinuc[1] was
the 3' context base instead of the ref base. generate_snv uses trinuc[1] as
the ref base for transition-matrix lookup and REF==ALT zeroing, so the wrong
base was being consulted — Keshav's zeroing fix in #267 only worked when
reference[pos] == reference[pos+1].

Fix: shift the slice to reference[local_location-1: local_location+2] so
trinuc[0]=5' flank, trinuc[1]=ref base, trinuc[2]=3' flank.

Also remove the dead self.all_ins.append(temp_snv) in generate_snv; SNVs
were being accumulated in MutationModel.all_ins (a list that is never read)
rather than nowhere, a copy-paste artifact from generate_deletion.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@joshfactorial joshfactorial force-pushed the fix/trinuc-slice-offbyone branch from 8c70e5a to 104ea3c Compare May 3, 2026 13:31
These lists were never read anywhere; ContigVariants has its own
independent all_ins/all_dels used for overlap detection.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@joshfactorial joshfactorial changed the title Fix/trinuc slice offbyone Fix for memory leak May 3, 2026
@joshfactorial joshfactorial merged commit 8821aaa into develop May 3, 2026
1 check passed
@joshfactorial joshfactorial deleted the fix/trinuc-slice-offbyone branch May 3, 2026 13:35
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