diff options
author | Dave Watson <davejwatson@fb.com> | 2016-10-23 22:56:30 (GMT) |
---|---|---|
committer | Jason Evans <jasone@canonware.com> | 2016-12-13 02:36:06 (GMT) |
commit | 2319152d9f5d9b33eebc36a50ccf4239f31c1ad9 (patch) | |
tree | 44a848c13219a110dec96d2969f6135f2a3c54f7 /test/integration | |
parent | d4c5aceb7cb5c5cf7a6dfd62e072c7dd12188998 (diff) | |
download | jemalloc-2319152d9f5d9b33eebc36a50ccf4239f31c1ad9.zip jemalloc-2319152d9f5d9b33eebc36a50ccf4239f31c1ad9.tar.gz jemalloc-2319152d9f5d9b33eebc36a50ccf4239f31c1ad9.tar.bz2 |
jemalloc cpp new/delete bindings
Adds cpp bindings for jemalloc, along with necessary autoconf settings.
This is mostly to add sized deallocation support, which can't be added
from C directly. Sized deallocation is ~10% microbench improvement.
* Import ax_cxx_compile_stdcxx.m4 from the autoconf repo, seems like the
easiest way to get c++14 detection.
* Adds various other changes, like CXXFLAGS, to configure.ac.
* Adds new rules to Makefile.in for src/jemalloc-cpp.cpp, and a basic
unittest.
* Both new and delete are overridden, to ensure jemalloc is used for
both.
* TODO future enhancement of avoiding extra PLT thunks for new and
delete - sdallocx and malloc are publicly exported jemalloc symbols,
using an alias would link them directly. Unfortunately, was having
trouble getting it to play nice with jemalloc's namespace support.
Testing:
Tested gcc 4.8, gcc 5, gcc 5.2, clang 4.0. Only gcc >= 5 has sized
deallocation support, verified that the rest build correctly.
Tested mac osx and Centos.
Tested --with-jemalloc-prefix and --without-export.
This resolves #202.
Diffstat (limited to 'test/integration')
-rw-r--r-- | test/integration/cpp/basic.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/test/integration/cpp/basic.cpp b/test/integration/cpp/basic.cpp new file mode 100644 index 0000000..eeb93c4 --- /dev/null +++ b/test/integration/cpp/basic.cpp @@ -0,0 +1,18 @@ +#include <memory> +#include "test/jemalloc_test.h" + +TEST_BEGIN(test_basic) +{ + auto foo = new long(4); + assert_ptr_not_null(foo, "Unexpected new[] failure"); + delete foo; +} +TEST_END + +int +main() +{ + + return (test( + test_basic)); +} |