fix: cache the GE_AUDIOTRACE getenv() check in alEvtqPostEvent (D250)

The D202/M-71 [EVTQ-DROP] diagnostic probe (gated at 56d2dfd6 after
being found unconditional) called getenv() uncached on every dropped
event post -- a real per-item hot path during audio event-pool
exhaustion, unlike the sibling GE_AUDIOTRACE probes in
synthesizer.c/csplayer.c/load.c which only run at one-shot init/load
call sites. Cached with the standard static-int pattern (D250, M-120),
matching the dozens of existing GE_* probe checks already using it.

Not yet re-linked -- build-pc is occupied by a concurrent investigation
this session; verify with a clean build + /linkcheck before the next
push.
This commit is contained in:
James Dansereau committed 2026-09-16 17:59:45 -04:00
1 parent 23da815dda
commit b73742ca2c
1 file changed
+7 -2
+7 -2
View File
@@ -93,8 +93,13 @@ void alEvtqPostEvent(ALEventQueue *evtq, ALEvent *evt, ALMicroTime delta)
* unconditional, so shipped builds wrote an unbounded log on every
* exhausted-queue post; found via GitHub #87's session logs, which
* showed sustained pool exhaustion (a real pool-sizing question,
* tracked separately) but should never write to disk by default. */
if (getenv("GE_AUDIOTRACE")) {
* tracked separately) but should never write to disk by default.
* getenv() is cached (D250, M-120): this runs on every dropped
* event post, a real per-item hot path, unlike the sibling probes'
* one-shot init/load call sites. */
static int s_audiotrace = -1;
if (s_audiotrace < 0) s_audiotrace = getenv("GE_AUDIOTRACE") != NULL;
if (s_audiotrace) {
geTracePrintf("audiotrace.log", "[EVTQ-DROP] evtq=%p type=%d state=%p delta=%d\n",
(void *)evtq, (int)evt->type,
(void *)((u8 *)evt + 2), (int)delta);