fix: use jemalloc as a default allocator inside DuckDB.#5258
Open
drrtuy wants to merge 2 commits into
Open
Conversation
There was a problem hiding this comment.
Code Review
This pull request enables the jemalloc extension for DuckDB by loading it in the CMake configuration and defining the necessary preprocessor flags. The reviewer correctly pointed out that overriding CMAKE_CXX_FLAGS directly in duckdb.cmake will discard existing compiler flags, such as optimization and debug flags, and suggested appending the new flags to ${CMAKE_CXX_FLAGS} instead.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
348d8f9 to
69f7792
Compare
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.
Use jemalloc as the default allocator for DuckDB
What
The DuckDB engine was compiling the glibc
malloc()path inallocator.cppeven thoughlibjemalloc_extension.awas being linked, becauseDUCKDB_EXTENSION_JEMALLOC_LINKEDwas only defined in theextension/scope and never reachedsrc/. This wires jemalloc in as the actual default allocator.Key changes
DUCKDB_EXTENSION_JEMALLOC_LINKED=1globally and add the jemalloc header include dir so theUSE_JEMALLOCbranch compiles induckdb_static.jemallocextension alongsidecore_functions,icu,json.errmsg-utf8.txt: add DuckDB engine error codes (ER_DUCKDB_*) appended at configure time forcomp_err.disabled.def: re-enable theduckdb_time_functest.How to test
Build the DuckDB plugin and confirm jemalloc symbols (
duckdb_je_*) are present; run the DuckDB mysql-test suite, including the re-enabledduckdb_time_func.