Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search

[REBOL] [unset] Memory optimization idea

From: atruter:labyrinth:au at: 21-Jan-2004 14:13

It occurred to me that there are a lot of functions (both native! and mezzanine), even with REBOL/Base, that are never used in my scripts. I sometimes 'unset the larger of these to minimize REBOL's memory footprint, which got me to thinking that it might be possible to create a 'func to do this for me. The logic would go something like this: pre-unset funcs: obtain a list of all globally defined functions (use 'what as a template) script post-unset remove-each from funcs where func appears in script remove-each from funcs where func appears in funcs/mezz foreach func funcs [unset 'func] unset 'pre-unset unset 'self recycle Which should work so long as native! func's don't depend on other func's (native! or not). If this concept works, it could then be extended to other (eg. VID) words so long as the script does not create dynamic references (which is rare for non-user defined words in my scripts at least). What I was hoping is that there might be an easy way to answer the question, "Which words in the global context are not being used, and can they be unset safely?". Comments? Regards, Ashley<