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

Adding an option to link jemalloc as the malloc implementation #780

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

tharanga
Copy link
Contributor

No description provided.

Copy link
Member

@dormando dormando left a comment

Choose a reason for hiding this comment

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

nits, thanks!

configure.ac Outdated
@@ -114,6 +114,9 @@ AC_ARG_ENABLE(static,
AC_ARG_ENABLE(unix_socket,
[AS_HELP_STRING([--disable-unix-socket], [Disable unix domain socket])])

AC_ARG_ENABLE(enable_linking_jemalloc,
[AS_HELP_STRING([--enable_linking_jemalloc], [Link jemalloc as the memory allocator implementation])])
Copy link
Member

Choose a reason for hiding this comment

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

help string should be dashes not underscores. Also maybe just --enable-jemalloc ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

@@ -217,6 +220,10 @@ if test "x$enable_unix_socket" = "xno"; then
AC_DEFINE([DISABLE_UNIX_SOCKET],1,[Set to nonzero if you want to disable unix domain socket])
fi

if test "x$enable_linking_jemalloc" = "xyes"; then
LIBS="$LIBS -ljemalloc"
Copy link
Member

Choose a reason for hiding this comment

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

Are there any easy tests we can do here? pkg-config or something?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added t/jemalloc.t which uses ldd to check the binary.

Copy link
Member

Choose a reason for hiding this comment

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

I can't remember what I was thinking at the time, but I bet what I meant was detecting if jemalloc existed on the system before trying to link it. So by "Tests" I meant autoconf tests. That would make more sense, I think? :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Got it. dpkg seems to be providing both lib existence and the version.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Let me try with ldconfig

@dormando
Copy link
Member

dormando commented Aug 5, 2021

@tharanga pinging again

@dormando
Copy link
Member

dormando commented Aug 6, 2021

Test fails here :)

@tharanga
Copy link
Contributor Author

tharanga commented Aug 6, 2021

@dormando if everything is good, I will squash this.

Makefile.am Outdated
test: memcached-debug sizes testapp
$(builddir)/sizes
$(builddir)/testapp
if ENABLE_JEMALLOC
@JEMALLOC_TEST=1 prove $(srcdir)/t/jemalloc.t
Copy link
Member

@dormando dormando Aug 6, 2021

Choose a reason for hiding this comment

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

Is there another runtime/startitme way to detect if jemalloc exists? This causes this one test to run not in parallel. I spend a lot of time running these tests :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We need to somehow wire the fact jemalloc is linked from configuration to tests. Though a bit of an overkill, a different make target would work I believe?

Copy link
Member

Choose a reason for hiding this comment

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

jemalloc/jemalloc#388 - I see a couple decent approaches here. Should be easy to add a supports_jemalloc() test to the ones in t/lib/MemcachedTest.pm

Copy link
Member

Choose a reason for hiding this comment

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

Looking at the test again.. trying to figure out what the goal of it is. If jemalloc is enabled, it's checking that it's enabled via ldd?

So the supports() test could be looking for something that configure would dump (like a "HAVE_JEMALLOC" in config.h, would be pretty easy to add)

Copy link
Member

Choose a reason for hiding this comment

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

maybe ignore this comment and see the other one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants