-
-
Notifications
You must be signed in to change notification settings - Fork 49
Fix memory leak in LiftWriter #1484
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix memory leak in LiftWriter #1484
Conversation
|
@copilot Do the inspection step and report on the results. Wait for interaction before continuing. |
Inspection complete. Findings: LiftWriter owns only an XmlWriter; End closes it but does not set Disposed or clear the reference, so repeated End without Dispose leaves the object holding its writer until GC (no finalizer in release), which could explain transient memory growth if callers skip Dispose. Dispose(bool) closes the writer, but VerifyNotDisposed is inverted (throws when not disposed), so it isn’t usable to guard against improper reuse. Also noticed small resource hygiene gaps: per-Add language form validation creates XmlReader/StringReader instances without disposing them. No code changes made yet—let me know if you want me to proceed with a concrete repro harness and fixes (e.g., dispose/clear writer, correct Disposed semantics, dispose temp readers). |
|
@copilot Show the XmlReader/StringReader instance leak and a proposed solution, wait for approval before making a commit. |
|
@copilot Make the proposed change and commit it. Then show in context the possible XmlWriter leak and a proposed fix. Wait for approval before committing. |
Co-authored-by: jasonleenaylor <2295227+jasonleenaylor@users.noreply.github.com>
XmlReader/StringReader disposal fixed in 87036ce (WriteLanguageFormsInWrapper now wraps the XmlReader creation in nested using blocks). Possible XmlWriter leak: End() flushes/closes the writer but never marks Disposed or releases the reference, so callers that only call End() keep a live LiftWriter holding a closed XmlWriter until GC. Proposed fix (pending approval): have End() call Dispose(true) (or at least |
|
The other suggestion was not likely to be the cause so I've ignored it for now. |
|
@copilot Add a very brief summary of this fix to the "Fixed" subsection of the "Unreleased" section of |
imnasnainaec
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@imnasnainaec reviewed 2 of 2 files at r1, all commit messages.
Reviewable status:complete! all files reviewed, all discussions resolved (waiting on @jasonleenaylor)
LiftWriter in SIL.DictionaryServices appears to leak several MB per use; investigation and fix are needed.
No additional code paths changed beyond the temporary reader disposal; further remediation pending approval.
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.
This change is