From 9cd53384f1013bb03eab7744db6974293fb9cd65 Mon Sep 17 00:00:00 2001 From: Qi Wang Date: Tue, 8 Aug 2023 14:42:37 -0700 Subject: [PATCH] Add example of static linking --- Getting-Started.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Getting-Started.md b/Getting-Started.md index ca198d9..bccc08a 100644 --- a/Getting-Started.md +++ b/Getting-Started.md @@ -18,6 +18,12 @@ There are several ways to integrate jemalloc into an application. Here are some cc app.c -o app -L`jemalloc-config --libdir` -Wl,-rpath,`jemalloc-config --libdir` -ljemalloc `jemalloc-config --libs` ``` +* Link jemalloc **statically** into the application at build time, and use it as a generic non-replaceable malloc implementation: + + ```sh + cc app.c -o app `jemalloc-config --libdir`/libjemalloc.a `jemalloc-config --libs` + ``` + * Compile jemalloc with an API prefix (see the `--with-jemalloc-prefix` configure option), link with jemalloc at build time as above, but use jemalloc distinctly from the system allocator. Once you have jemalloc integrated into your application, you can use special features in a variety of ways: