No description
Find a file
Connor McEntee 8b561971c4 feat: enable prof integration tests
Refactor prof flag test changes and handle source inclusion. This enables
prof tests for all integration tests.
2025-04-25 17:31:20 -06:00
bin fix some typos 2022-04-25 11:29:00 -07:00
build-aux Update config.{sub,guess} to support support-aarch64-apple-darwin as a target 2021-01-11 14:00:03 -08:00
doc Make the default option of zero realloc match the system allocator. 2022-05-05 17:11:18 -07:00
doc_internal Add a logo to doc_internal. 2020-10-19 15:32:51 -07:00
examples fix: build with --stamp 2025-04-14 22:09:28 -06:00
include Added support for building with prof. (#1) 2025-04-25 17:27:50 -06:00
m4 Support C++17 over-aligned allocation 2019-11-22 10:14:16 -08:00
msvc Update visual studio projects 2021-12-15 10:39:17 -08:00
scripts Reoreder TravisCI jobs to optimize CI time 2022-03-29 11:58:27 -07:00
settings Added support for building with prof. (#1) 2025-04-25 17:27:50 -06:00
src Make the default option of zero realloc match the system allocator. 2022-05-05 17:11:18 -07:00
test feat: enable prof integration tests 2025-04-25 17:31:20 -06:00
tools feat: enable prof integration tests 2025-04-25 17:31:20 -06:00
.appveyor.yml Appveyor: fix 404 errors. 2020-10-27 15:28:20 -07:00
.autom4te.cfg Disable autom4te cache. 2014-09-02 17:49:29 -07:00
.bazelignore feat: Introduce stable Bazel build 2025-03-03 19:43:24 -07:00
.bazelrc Added support for building with prof. (#1) 2025-04-25 17:27:50 -06:00
.cirrus.yml Update FreeBSD image to 12.3 for cirrus ci. 2022-04-19 15:29:30 -07:00
.clang-format Add a .clang-format file. 2020-10-02 14:49:56 -07:00
.gitattributes fix git handling of newlines on windows 2014-05-07 18:48:39 -04:00
.gitignore feat: Introduce stable Bazel build 2025-03-03 19:43:24 -07:00
.travis.yml Reoreder TravisCI jobs to optimize CI time 2022-03-29 11:58:27 -07:00
autogen.sh Move repo contents in jemalloc/ to top level. 2011-03-31 20:36:17 -07:00
BUILD.bazel Added support for building with prof. (#1) 2025-04-25 17:27:50 -06:00
ChangeLog Update ChangeLog for 5.3.0. 2022-05-06 11:24:21 -07:00
config.stamp.in Move repo contents in jemalloc/ to top level. 2011-03-31 20:36:17 -07:00
configure.ac Make the default option of zero realloc match the system allocator. 2022-05-05 17:11:18 -07:00
COPYING Update copyright dates. 2019-01-25 13:25:20 -08:00
INSTALL.md Document 'make uninstall' 2022-01-31 14:55:00 -08:00
jemalloc.pc.in Reformat the version number in jemalloc.pc.in. 2018-05-07 20:12:03 -07:00
Makefile.in Rename zero_realloc option "strict" to "alloc". 2022-04-20 10:27:25 -07:00
MODULE.bazel feat: enable prof integration tests 2025-04-25 17:31:20 -06:00
MODULE.bazel.lock Added support for building with prof. (#1) 2025-04-25 17:27:50 -06:00
README Update project URL. 2016-09-12 11:56:24 -07:00
README.md feat: Introduce stable Bazel build 2025-03-03 19:43:24 -07:00
run_tests.sh Introduce scripts to run all possible tests 2017-01-30 17:51:57 -08:00
TUNING.md Update TUNING.md to include the new tcache_max option. 2022-05-04 10:59:40 -07:00

Bazel build of jemalloc

This is a minimal fork of jemalloc to maintain a set of overlay files for building jemalloc with Bazel.

The upstream jemalloc build performs a number of feature detection steps in the configure script. All of which need to be statically declared via platform and compiler constraints. Some of these have been made configurable under //settings, but the list is not exhaustive. An attempt has been made to default to logical values assuming the most common configurations. But these assumptions cannot satisfy all cases in the wild and may break on some systems. Contributors are encouraged to open MRs to add more configuration options to //settings/platform.

Usage

See the examples/BUILD.bazel file for examples of how to consume @jemalloc.

Notes

  • //settings/flags:jemalloc_prefix (--with-jemalloc-prefix): In contrast to the make build, this defaults to having no prefix. The original reasoning was that jemalloc was likely to replace malloc on linux but not MacOS or Windows. In practice in Bazel, this forcibly bifurcates the API based on target platform making the cc_library more difficult to consume by cross-platform downstream targets. Anyone wanting to eject jemalloc as an .so will likely want to reintroduce this behavior.
  • //settings/platform:lg_vaddr: Defaults to the hard-coded cross compilation value of 57 from the configure script. If targeting a 32-bit platform, this should be explicitly set.
  • glibc: Assumes a modern version. If jemalloc is compiled to be the default allocator on linux, it assumes glibc and some publicly exposed symbols can be wrapped: __malloc_hook, __realloc_hook, __free_hook, __memalign_hook. However, they are deprecated since glibc 2.34. The jemalloc source likely needs to be updated to reflect this.

Platform configurations that have defaults that are applied via transition.

  • //settings/flags:enable_zone_allocator
  • //settings/platform:glibc_overrides_support
  • //settings/platform:lg_page
  • //settings/platform:memalign_support
  • //settings/platform:malloc_size_support
  • //settings/platform:usable_size_const
  • //settings/platform:valloc_support

Validated Platforms

  • Ubuntu 20.04 & 22.04
  • Debian 10
  • MacOS 15 (M3)

Known Issues

  • Windows: An effort to was made to translate upstream MSVC configuration, but it has not been validated and will likely fail.
  • FreeBSD: An effort was made to translate existing autoconf feature detection to Bazel config settings, but no attempt has been made to build on FreeBSD.
  • Centos 7: Fails due to the lack of defining JEMALLOC_MADV_FREE. Though, the original build does not set it when MADV_FREE is present. Supporting both and being faithful to the configure script would require an additional platform setting.
  • C++ compilation might be broken for LLVM around detecting libstdc++.

Contributing

Before contributing new versions or updates to the Bazel Central Registry, these contributions should be made as Merge Requests here:

  • Fork the repository targeting the existing BCR release branch (e.g bcr-5.3.0) for the jemalloc version or create a new one
  • Verify the that all tests pass on the supported platforms e.g. bazel test //...
  • Open a Merge Request