[REBOL] Re: Rebol for real world applications
From: rotenca:telvia:it at: 20-Nov-2003 0:54
Memory is auto-recycled.
You can force recycling with the recycle function.
You can test the memory allocated by your program with system/stats
You can have an idea of memory used by some code with these routines:
> cfg: make object!  ; global variable. Is this needed?
> pp:  ; global variable. Is this needed?
No. Non locals are made globals in Rebol when you load a file.
> loadCfg: function [cfgfile] [kk]
> either error? try [ kk: read cfgfile
> pp: to-block kk
You should use load/all.
To-block works, but it does not load words in the global context.
Un-loaded words are buggy in Rebol and can lead to crashes.
> [ return false ]
> cfg: make object! pp
> clear pp;
> return true
your function can become:
loadCfg: func [cfgfile][
not error? try [
cfg: make object! load/all cfgfile
>> loadcfg "a: 2"
>> probe cfg
make object! [
You should know that make object! executes the body block (the loaded block),
so it is not secure.