From 01aa8358f0a4403054c9743fc28d7ed5a355c4bc Mon Sep 17 00:00:00 2001 From: Erica Fischer Date: Wed, 18 Jan 2023 13:45:16 -0800 Subject: [PATCH] Switch string pool from memory to disk when memory is 10% full --- pool.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/pool.cpp b/pool.cpp index 3efca4aa..17e37c57 100644 --- a/pool.cpp +++ b/pool.cpp @@ -77,8 +77,10 @@ long long addpool(struct memfile *poolfile, struct memfile *treefile, const char } } - // Size of memory divided by 5 from observation of OOM errors on ECS - if ((size_t) (poolfile->off + treefile->off) > memsize / CPUS / 5) { + // Size of memory divided by 10 from observation of OOM errors (when supposedly + // 20% of memory is full) and onset of thrashing (when supposedly 15% of memory + // is full) on ECS. + if ((size_t) (poolfile->off + treefile->off) > memsize / CPUS / 10) { // If the pool and search tree get to be larger than physical memory, // then searching will start thrashing. Switch to appending strings // to the file instead of keeping them in memory.