diff --git a/profiling/src/profiling/stack_walking.rs b/profiling/src/profiling/stack_walking.rs index fe914b00079..339dedb899a 100644 --- a/profiling/src/profiling/stack_walking.rs +++ b/profiling/src/profiling/stack_walking.rs @@ -172,8 +172,10 @@ mod detail { CACHED_STRINGS.with(|cell| { let set: &StringSet = &cell.borrow(); let arena_used_bytes = set.arena_used_bytes(); - // todo: pin down threshold - let threshold = 4 * 1024 * 1024; + // A slow ramp up to 2 MiB is probably _not_ going to look like + // a memory leak, whereas a higher threshold could make a user + // suspect a leak. + let threshold = 2 * 1024 * 1024; if arena_used_bytes > threshold { debug!("string cache arena is using {arena_used_bytes} bytes which exceeds the {threshold} byte threshold, resetting"); // Note that this cannot be done _during_ a request. The diff --git a/profiling/src/string_set.rs b/profiling/src/string_set.rs index d35352b18df..5a8a89fa01d 100644 --- a/profiling/src/string_set.rs +++ b/profiling/src/string_set.rs @@ -35,7 +35,7 @@ impl StringSet { // Keep this in the megabyte range. It's virtual, so we do not need // to worry much about unused amounts, but asking for wildly too much // up front, like in gigabyte+ range, is not good either. - const SIZE_HINT: usize = 4 * 1024 * 1024; + const SIZE_HINT: usize = 2 * 1024 * 1024; let arena = ChainAllocator::new_in(SIZE_HINT, VirtualAllocator {}); let mut strings = HashSet::with_hasher(Hasher::default());