MCPcopy Create free account
hub / github.com/AutoHotkey/AutoHotkey / FreeDerefBufIfLarge

Method FreeDerefBufIfLarge

source/script.cpp:9531–9549  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

9529
9530
9531void Line::FreeDerefBufIfLarge()
9532{
9533 if (sDerefBufSize > LARGE_DEREF_BUF_SIZE)
9534 {
9535 // Freeing the buffer should be safe even if the script's current quasi-thread is in the middle
9536 // of executing a command, since commands are all designed to make only temporary use of the
9537 // deref buffer (they make copies of anything they need prior to calling MsgSleep() or anything
9538 // else that might pump messages and thus result in a call to us here).
9539 free(sDerefBuf); // The above size-check has ensured this is non-NULL.
9540 SET_S_DEREF_BUF(NULL, 0);
9541 --sLargeDerefBufs;
9542 if (!sLargeDerefBufs)
9543 KILL_DEREF_TIMER
9544 }
9545 //else leave the timer running because some other deref buffer in a recursed ExpandArgs() layer
9546 // is still waiting to be freed (even if it isn't, it should be harmless to keep the timer running
9547 // just in case, since each call to ExpandArgs() will reset/postpone the timer due to the script
9548 // having demonstrated that it isn't idle).
9549}
9550
9551
9552

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected