From 85308f6f13aa9f82ab919fa82d9c9668f7564789 Mon Sep 17 00:00:00 2001 From: "Alexey K." Date: Fri, 10 Jan 2025 10:19:18 +0300 Subject: [PATCH] Jemalloc option in README.md --- README.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/README.md b/README.md index 2f145d65..5a924938 100644 --- a/README.md +++ b/README.md @@ -106,6 +106,18 @@ This will reduce GLib memory appetites by reducing the number of malloc arenas that it can create. By default GLib creates one are per thread, and this would follow to memory fragmentation. +### Jemalloc +If the arena option doesn't help, you can try replacing the standard allocator with `jemalloc`, +which emphasizes fragmentation avoidance and scalable concurrency support. + +To do this, you need to install the `libjemalloc-dev` package. +And pass the following flags for build command: + +``` +CGO_CFLAGS="-fno-builtin-malloc -fno-builtin-calloc -fno-builtin-realloc -fno-builtin-free" CGO_LDFLAGS="-ljemalloc" go build +``` + + ## Contributing Feel free to file issues or create pull requests. See this [guide on contributing](https://github.com/davidbyttow/govips/blob/master/CONTRIBUTING.md) for more information.