Quellcode durchsuchen

docs: released vector memory returns through jemalloc's purge, not malloc_trim

fszontagh vor 3 Wochen
Ursprung
Commit
5825062da2
3 geänderte Dateien mit 21 neuen und 4 gelöschten Zeilen
  1. 7 0
      CHANGELOG.md
  2. 0 0
      CLAUDE.md
  3. 14 4
      docs/integration-guide.md

+ 7 - 0
CHANGELOG.md

@@ -12,6 +12,13 @@ consumer-facing usage is in `docs/integration-guide.md`.
 
 ## Unreleased
 
+### Fixed
+- **[docs]** The 2.21.3 guide said the server's `malloc_trim` returns
+  released vector memory to the system. The packaged server uses jemalloc, so
+  memory goes back through jemalloc's background purge, which the systemd
+  unit's `MALLOC_CONF` turns on. Without it, an idle process keeps the pages
+  (measured: 32 MB of 194 MB returned, against all of it with the setting).
+
 ## 2.21.3 - 2026-11-03 (bug fix, server + client)
 
 ### Added

Datei-Diff unterdrückt, da er zu groß ist
+ 0 - 0
CLAUDE.md


+ 14 - 4
docs/integration-guide.md

@@ -2412,10 +2412,20 @@ memory pressure:
   loses no candidates; an LMDB read error there is an error, not a shorter
   answer.
 - **The memory line** reads `..., of which vectors V MB (R more in LMDB
-  only), ...`: `V` is what is still in memory, `R` the number released. After
-  a release of 16 MB or more the server calls `malloc_trim` so the freed
-  memory goes back to the system. At boot the snapshot still loads every
-  vector into memory (the boot peak is unchanged); the first tick releases them.
+  only), ...`: `V` is what is still in memory, `R` the number released. At
+  boot the snapshot still loads every vector into memory (the boot peak is
+  unchanged); the first tick releases them.
+- **The freed memory goes back to the system only with jemalloc's background
+  purge.** The packaged server allocates with jemalloc, and the systemd unit
+  sets `MALLOC_CONF=background_thread:true,dirty_decay_ms:1000,muzzy_decay_ms:1000`.
+  With it, RssAnon falls by the released vectors within seconds (measured: a
+  store with 194 MB of vectors went 367 -> 121 MB). **Without it** (the binary
+  started by hand or in a container that does not set it), jemalloc purges
+  only on allocation activity, so an idle process keeps the pages: the same
+  store went 371 -> 339 MB and stayed there, while the estimate fell by the
+  full 194 MB. Run the server with the unit's `MALLOC_CONF` wherever it runs.
+  (The server also calls `malloc_trim` after a large release; that helps only
+  a build linked against glibc malloc.)
 
 Not changed: the first search on a collection still reads its vectors from
 disk into the page cache (about `rows x dimension x 4` bytes). With the

Einige Dateien werden nicht angezeigt, da zu viele Dateien in diesem Diff geändert wurden.