Repository navigation
Free input provider callbacks on cleanup - #167
Merged
jameslan merged 2 commits intoAug 25, 2026
Merged
Conversation
shunkica
force-pushed
the
fix/input-provider-table-leak
branch
2 times, most recently
from
August 4, 2026 09:38
c4830c6 to
0e877cd
Compare
xmlRegisterInputProvider adds four wasm function-table entries per call, one per callback closure, and xmlCleanupInputProvider reclaimed none of them. addFunction cannot reuse an entry until removeFunction releases it, so every register grew the table by four permanently and pinned the provider and its buffers for the process lifetime. Export Emscripten's removeFunction, track the entries of each registration and release them in cleanup. A registration that libxml2 refuses now frees its entries as well, instead of stranding them.
shunkica
force-pushed
the
fix/input-provider-table-leak
branch
from
August 4, 2026 09:45
0e877cd to
6d2c0a0
Compare
jameslan
approved these changes
Aug 25, 2026
|
Coverage after merging fix/input-provider-table-leak into master will be
Coverage Report
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
jameslan
added a commit
that referenced
this pull request
Sep 5, 2026
xmlRegisterInputProvider adds four wasm function-table entries per call, one per callback closure, and xmlCleanupInputProvider reclaimed none of them. addFunction cannot reuse an entry until removeFunction releases it, so every register grew the table by four permanently and pinned the provider and its buffers for the process lifetime. Export Emscripten's removeFunction, track the entries of each registration and release them in cleanup. A registration that libxml2 refuses now frees its entries as well, instead of stranding them. Co-authored-by: James Lan <jameslan@gmail.com>
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.
Closes #166
Fix
xmlRegisterInputProvideradds four wasm function-table entries per call, one percallback closure (
match/open/read/close), andxmlCleanupInputProviderreclaimed none of them.
addFunctioncannot reuse an entry untilremoveFunctionreleases it, so every register grew the table by four permanently and pinned the
provider, and any buffers it captured, for the process lifetime.
binding/exported-runtime-functions.txtexportsremoveFunction(
-s ALLOW_TABLE_GROWTH=1is already set, so no other emcc change is needed).src/libxml2.mtstracks the entries of each registration and releases them incleanup. libxml2 keeps owning the callback stack and its precedence, and the
provider's file descriptors still pass straight through.