Skip to content

fix: use jemalloc as a default allocator inside DuckDB.#5258

Open
drrtuy wants to merge 2 commits into
MariaDB:11.4from
drrtuy:bb-11.4-duckdb-jemalloc
Open

fix: use jemalloc as a default allocator inside DuckDB.#5258
drrtuy wants to merge 2 commits into
MariaDB:11.4from
drrtuy:bb-11.4-duckdb-jemalloc

Conversation

@drrtuy

@drrtuy drrtuy commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

Use jemalloc as the default allocator for DuckDB

What

The DuckDB engine was compiling the glibc malloc() path in allocator.cpp even though libjemalloc_extension.a was being linked, because DUCKDB_EXTENSION_JEMALLOC_LINKED was only defined in the extension/ scope and never reached src/. This wires jemalloc in as the actual default allocator.

Key changes

  • duckdb.cmake: define DUCKDB_EXTENSION_JEMALLOC_LINKED=1 globally and add the jemalloc header include dir so the USE_JEMALLOC branch compiles in duckdb_static.
  • duckdb_extensions.cmake: load the jemalloc extension alongside core_functions, icu, json.
  • errmsg-utf8.txt: add DuckDB engine error codes (ER_DUCKDB_*) appended at configure time for comp_err.
  • disabled.def: re-enable the duckdb_time_func test.

How to test

Build the DuckDB plugin and confirm jemalloc symbols (duckdb_je_*) are present; run the DuckDB mysql-test suite, including the re-enabled duckdb_time_func.

@drrtuy drrtuy requested a review from vuvova June 18, 2026 18:59

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread storage/duckdb/cmake/duckdb.cmake
@drrtuy drrtuy force-pushed the bb-11.4-duckdb-jemalloc branch from 348d8f9 to 69f7792 Compare June 19, 2026 09:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

2 participants