forked from OpenAtomFoundation/pika
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
1) add detect_tcmalloc, so pika could link tcmalloc dynamically; 2) c…
…hange memory cmd name to tcmalloc;
- Loading branch information
1 parent
5f0d2b5
commit 4f6c214
Showing
7 changed files
with
69 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
#!/bin/sh | ||
|
||
OUTPUT=$1 | ||
if test -z "$OUTPUT"; then | ||
echo "usage: $0 <output-filename>" >&2 | ||
exit 1 | ||
fi | ||
|
||
# Delete existing output, if it exists | ||
rm -f "$OUTPUT" | ||
touch "$OUTPUT" | ||
|
||
if test -z "$CXX"; then | ||
CXX=g++ | ||
fi | ||
|
||
# Test whether tcmalloc is available | ||
if echo 'int main() {}' | $CXX $CFLAGS -x c++ - -o /dev/null \ | ||
-ltcmalloc 2>/dev/null; then | ||
TCMALLOC_LDFLAGS=" -ltcmalloc" | ||
fi | ||
|
||
# Test whether malloc_extension is available | ||
$CXX $CFLAGS -x c++ - -o /dev/null -ltcmalloc 2>/dev/null <<EOF | ||
#include <gperftools/malloc_extension.h> | ||
int main() { | ||
MallocExtension::instance()->Initialize();; | ||
return 0; | ||
} | ||
EOF | ||
if [ "$?" = 0 ]; then | ||
TCMALLOC_EXTENSION_FLAGS=" -DTCMALLOC_EXTENSION" | ||
fi | ||
|
||
echo "TCMALLOC_EXTENSION_FLAGS=$TCMALLOC_EXTENSION_FLAGS" >> "$OUTPUT" | ||
echo "TCMALLOC_LDFLAGS=$TCMALLOC_LDFLAGS" >> "$OUTPUT" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters