// SPDX-License-Identifier: MIT // Copyright (c) 2026 Incoprea // Check a planned memory budget // Not compiled or tested in-world // Setup: Set REQUIRED_BYTES and touch as owner. // Stop / restore: Remove or reset the script to stop the diagnostic. No build properties are changed. // Notes: This measures only this script at that instant; it cannot guarantee later allocations succeed. Engine accounting and garbage collection vary. // License: see LICENSE in this distribution. // Original Incoprea example. MIT. integer REQUIRED_BYTES=8192; default { touch_start(integer touches) { if(llDetectedKey(0)!=llGetOwner())return; if(REQUIRED_BYTES<0 || REQUIRED_BYTES>65536) { llOwnerSay("Use a requirement from 0 to 65536 bytes."); return; } integer available=llGetFreeMemory(); llOwnerSay("Observed free bytes: "+(string)available); if(available>=REQUIRED_BYTES)llOwnerSay("Current snapshot meets the configured headroom."); else llOwnerSay("Current snapshot is below the configured headroom."); } changed(integer flags) { if(flags & CHANGED_OWNER)llResetScript(); } }