From 143ed49de03c9b74b26ff7eec1240dda996c4826 Mon Sep 17 00:00:00 2001 From: InfinityPacer Date: Mon, 28 Sep 2026 18:11:56 +0800 Subject: [PATCH] docs(runtime): drop redundant allocator comments Co-Authored-By: Claude Opus 5.5 --- app/main.py | 1 - app/runtime/gc.py | 1 - tests/test_runtime_allocator_release.py | 2 -- 3 files changed, 4 deletions(-) diff --git a/app/main.py b/app/main.py index 4d01dd5b0..2f1b9ec30 100644 --- a/app/main.py +++ b/app/main.py @@ -204,7 +204,6 @@ def run_application() -> None: ) signal.signal(signal.SIGTERM, signal_handler) signal.signal(signal.SIGINT, signal_handler) - # 只在主进程开启分配器后台回收,浏览器等子进程不继承 from app.runtime.gc import configure_allocator_background_thread configure_allocator_background_thread() diff --git a/app/runtime/gc.py b/app/runtime/gc.py index 17ee82499..91684b379 100644 --- a/app/runtime/gc.py +++ b/app/runtime/gc.py @@ -89,7 +89,6 @@ def get_memory_usage() -> float: _JEMALLOC_ARENAS_ALL_PURGE = b"arena.4096.purge" # 把调用线程的线程缓存(tcache)交还所属 arena _JEMALLOC_THREAD_TCACHE_FLUSH = b"thread.tcache.flush" -# 后台回收线程开关与数量上限,均可在运行时写入 _JEMALLOC_BACKGROUND_THREAD = b"background_thread" _JEMALLOC_MAX_BACKGROUND_THREADS = b"max_background_threads" # MALLOC_CONF 中与后台线程相关、不能被子进程继承的配置项 diff --git a/tests/test_runtime_allocator_release.py b/tests/test_runtime_allocator_release.py index 5b90e57dd..4776a3d43 100644 --- a/tests/test_runtime_allocator_release.py +++ b/tests/test_runtime_allocator_release.py @@ -151,7 +151,6 @@ def test_thread_cache_flush_is_a_no_op_without_jemalloc(linux, monkeypatch): def test_background_thread_enabled_at_runtime(linux, monkeypatch): - """未配置后台线程时在主进程内开启,先设上限再打开开关,子进程环境保持不变。""" monkeypatch.setenv("MALLOC_CONF", "narenas:8,dirty_decay_ms:5000") mallctl = _FakeSymbol() _use_lib(monkeypatch, _FakeLib(mallctl=mallctl)) @@ -163,7 +162,6 @@ def test_background_thread_enabled_at_runtime(linux, monkeypatch): def test_inherited_background_thread_conf_is_stripped(linux, monkeypatch): - """v3.0.10 镜像把后台线程写进了 MALLOC_CONF;主进程已按其生效,只需从子进程将继承的环境中去掉。""" monkeypatch.setenv( "MALLOC_CONF", "background_thread:true,max_background_threads:1,narenas:8,dirty_decay_ms:5000,muzzy_decay_ms:0",