Enable open source users to use jemalloc (github issue #438)
Summary: Currently open source rocksdb only builds with tcmalloc. This diff first checks if jemalloc is available. If it is, it compiles with jemalloc. If it isn't, it checks for tcmalloc. Test Plan: Tried this out on my Ubuntu virtual machine and confirms that jemalloc is correctly detected and compiled. Reviewers: MarkCallaghan, yhchiang, rven, sdong Reviewed By: sdong Subscribers: adamretter, meyering, dhruba, leveldb Differential Revision: https://reviews.facebook.net/D36789
This commit is contained in:
parent
aa14670b27
commit
fd7a357318
@ -270,13 +270,18 @@ EOF
|
|||||||
JAVA_LDFLAGS="$JAVA_LDFLAGS -lnuma"
|
JAVA_LDFLAGS="$JAVA_LDFLAGS -lnuma"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Test whether tcmalloc is available
|
# Test whether jemalloc is available
|
||||||
$CXX $CFLAGS -x c++ - -o /dev/null -ltcmalloc 2>/dev/null <<EOF
|
if echo 'int main() {}' | $CXX $CFLAGS -x c++ - -o /dev/null -ljemalloc \
|
||||||
int main() {}
|
2>/dev/null; then
|
||||||
EOF
|
PLATFORM_LDFLAGS="$PLATFORM_LDFLAGS -ljemalloc"
|
||||||
if [ "$?" = 0 ]; then
|
JAVA_LDFLAGS="$JAVA_LDFLAGS -ljemalloc"
|
||||||
PLATFORM_LDFLAGS="$PLATFORM_LDFLAGS -ltcmalloc"
|
else
|
||||||
JAVA_LDFLAGS="$JAVA_LDFLAGS -ltcmalloc"
|
# jemalloc is not available. Let's try tcmalloc
|
||||||
|
if echo 'int main() {}' | $CXX $CFLAGS -x c++ - -o /dev/null \
|
||||||
|
-ltcmalloc 2>/dev/null; then
|
||||||
|
PLATFORM_LDFLAGS="$PLATFORM_LDFLAGS -ltcmalloc"
|
||||||
|
JAVA_LDFLAGS="$JAVA_LDFLAGS -ltcmalloc"
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user