Skip to content
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

perf: use default memory management within libxml2 #2734

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 0 additions & 19 deletions ext/nokogiri/nokogiri.c
Original file line number Diff line number Diff line change
Expand Up @@ -176,26 +176,7 @@ Init_nokogiri()
rb_const_set(mNokogiri, rb_intern("OTHER_LIBRARY_VERSIONS"), NOKOGIRI_STR_NEW2(NOKOGIRI_OTHER_LIBRARY_VERSIONS));
#endif

#if defined(_WIN32) && !defined(NOKOGIRI_PACKAGED_LIBRARIES)
/*
* We choose *not* to do use Ruby's memory management functions with windows DLLs because of this
* issue in libxml 2.9.12:
*
* https://github.com/sparklemotion/nokogiri/issues/2241
*
* If the atexit() issue gets fixed in a future version of libxml2, then we may be able to skip
* this config only for the specific libxml2 versions 2.9.12.
*
* Alternatively, now that Ruby has a generational GC, it might be OK to let libxml2 use its
* default memory management functions (recall that this config was introduced to reduce memory
* bloat and allow Ruby to GC more often); but we should *really* test with production workloads
* before making that kind of a potentially-invasive change.
*/
rb_const_set(mNokogiri, rb_intern("LIBXML_MEMORY_MANAGEMENT"), NOKOGIRI_STR_NEW2("default"));
#else
rb_const_set(mNokogiri, rb_intern("LIBXML_MEMORY_MANAGEMENT"), NOKOGIRI_STR_NEW2("ruby"));
xmlMemSetup((xmlFreeFunc)ruby_xfree, (xmlMallocFunc)ruby_xmalloc, (xmlReallocFunc)ruby_xrealloc, ruby_strdup);
#endif

xmlInitParser();
exsltRegisterAll();
Expand Down