[sldev] Memory Allocation Algorithms and Tools - Script Limits
Darrius Gothly
dgothly at erotobotics.com
Fri Dec 18 16:49:29 PST 2009
Wandering thru the recent posts on memory and resource allocation schemes,
one thing becomes quite clear. There are a ton of different ways to
instrument and allocate the resources, but we won't find a good one until
such time as we "Consumers" of those resources (meaning script writers) have
the proper tools to accurately measure and *also* to take purposeful steps
to reduce or eliminate our use of resources period.
I've seen proposals that say "we need a full-blown memory management
library" .. in LSL? The language that makes BASIC look cryptic? Sorry, not
buying it.
How about this one instead?
New statement: llEnd() - This script is done, dead, finished, kaput, pushing
up the daisies .. whatever. All it had is yours again dear Sim. May it rest
in peace.
The only way to restart it is to manually "Reset" it. As has been mentioned,
many of the most common scripts start up, do something that will persist
past their lifetime, then stop. But just cuz they stopped doesn't mean they
let go their 16KB (or 64KB for MONO). However, if they ended with an llEnd()
statement .. no guessing needed there.
The infamous "hair example"? Owner selects then "Resets" hair. Every script
gets reset and comes alive. Resizer runs .. owner picks proper size and
clicks "Done" ... EVERY script goes "llEnd()" End of problem. You now have
hair perfectly sized (until your next shape or mood change) and you're not
walking around with 200 or 1000 scripts worth of memory usage. Wanna change
your hair again? No sweat ..
These sorts of simple extensions to the language would give even beginning
scripters the ability to write memory efficient (and thus polite) scripts
without having to master the art of proper memory pool and cache management.
k .. nuff said ... llEnd();
More information about the SLDev
mailing list