Skip to content

1. Added ~Scintilla() finalizer — ensures Dispose(false) is called by…#182

Merged
desjarlais merged 1 commit into
masterfrom
Unmanaged-Memory-Leak-in-AutoCSetFillUps
Apr 18, 2026
Merged

1. Added ~Scintilla() finalizer — ensures Dispose(false) is called by…#182
desjarlais merged 1 commit into
masterfrom
Unmanaged-Memory-Leak-in-AutoCSetFillUps

Conversation

@desjarlais
Copy link
Copy Markdown
Owner

… the GC if the consumer never calls Dispose() explicitly.

  1. Moved fillUpChars cleanup outside if (disposing) — fillUpChars is an unmanaged resource (Marshal.AllocHGlobal), so it must be freed in both the explicit (disposing = true) and finalizer (disposing = false) paths. Previously it was only freed when disposing was true, meaning the finalizer path would leak the memory.

… the GC if the consumer never calls Dispose() explicitly.

2. Moved fillUpChars cleanup outside if (disposing) — fillUpChars is an unmanaged resource (Marshal.AllocHGlobal), so it must be freed in both the explicit (disposing = true) and finalizer (disposing = false) paths. Previously it was only freed when disposing was true, meaning the finalizer path would leak the memory.
@desjarlais desjarlais merged commit 6eabd37 into master Apr 18, 2026
2 checks passed
@desjarlais desjarlais deleted the Unmanaged-Memory-Leak-in-AutoCSetFillUps branch April 18, 2026 16:26
@desjarlais desjarlais self-assigned this Apr 24, 2026
@desjarlais desjarlais added the bug Something isn't working label Apr 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants