Skip to content

webserver: guard heap trim behind glibc (Windows build fix) - #288

Merged
On1x merged 1 commit into
masterfrom
fix/heap-trim-platform-guard
Nov 19, 2026
Merged

On1x merged 1 commit into
masterfrom
fix/heap-trim-platform-guard

Conversation

@On1x

@On1x On1x commented Nov 19, 2026

Copy link
Copy Markdown
Member

Что

#287 добавил heap trim — malloc_trim(0), sysconf(_SC_PAGESIZE) и /proc/self/statm. Всё три — glibc-специфичны, и Windows Release покраснел на master 723e1bb:

plugins/webserver/webserver_plugin.cpp:689:43: error: '_SC_PAGESIZE' was not declared in this scope
plugins/webserver/webserver_plugin.cpp:689:35: error: 'sysconf' was not declared in this scope
plugins/webserver/webserver_plugin.cpp:700:37: error: 'malloc_trim' was not declared in this scope

Как

  • Гард #if defined(__GLIBC__) стоит и на include, и на теле функции: на MinGW/MSVC нет ни одной из трёх зависимостей.
  • Опция --webserver-heap-trim-sec остаётся в интерфейсе (общий конфиг на все платформы), но где trim не может работать — плагин говорит об этом один раз при старте и выключает его, а не печатает «heap trim every 60 s» и молчит впустую.
  • На Linux путь не тронут: проверено одиночным TU (-fsyntax-only, nice -n 19 ionice -c3, rc 0), и боевые четыре узла уже сутки живут на этом коде — в логе api.viz.world released 198 MiB (rss 326 -> 128 MiB).

Зачем это отдельным PR

Мастер сейчас несёт сломанную Windows-сборку. Фикс маленький и его надо влить, чтобы Windows Release снова стала зелёной.

🤖 Generated with Claude Code

malloc_trim, sysconf(_SC_PAGESIZE) and /proc/self/statm are glibc-only. Without a guard
the MinGW build failed on three undeclared names (webserver_plugin.cpp:689,700), so
Windows Release went red on the master commit that carried the trim.

The guard sits on the include and on the function body. The option stays in the
interface so one config works on every platform, but where the trim cannot run the
plugin says so once at startup and disables it, instead of logging 'heap trim every
60 s' and doing nothing.
@On1x
On1x merged commit c021ba3 into master Nov 19, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant