bcquality/microsoft/knowledge/performance/avoid-growing-globals-in-singleinstance-subscribers.bad.al
Jesper Schulz-Wedde 78eeb86a37 Promote performance knowledge from community to Microsoft layer
Pure git-mv relocation of all 7 performance articles from community/knowledge/performance/ to microsoft/knowledge/performance/. No content changes.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-06-25 14:03:39 +02:00

16 lines
599 B
AL

codeunit 50100 "Event Audit Buffer"
{
SingleInstance = true;
// Unbounded global: every event fires adds an entry for the lifetime of the session.
var
AllEventIds: List of [Guid];
[EventSubscriber(ObjectType::Table, Database::"Sales Header", OnAfterInsertEvent, '', false, false)]
local procedure OnAfterInsertSalesHeader(var Rec: Record "Sales Header")
begin
// No cap. No eviction. No reset. A session that sees ten thousand inserts
// keeps ten thousand GUIDs in memory until the user signs out.
AllEventIds.Add(Rec.SystemId);
end;
}