recycle
[1/3] from: louisaturk::eudoramail::com at: 16-Apr-2002 5:19
Hi rebols,
What exactly does recycle do, and how is it supposed to be used?
Let's say that you end a program in a rebol window, and want to reclaim all
the memory. Can you just type recycle at the command line? If the recycle
command is executed immediately before exiting a program will it reclaim
all the memory?
Louis
[2/3] from: anton:lexicon at: 17-Apr-2002 0:29
Recycle will not free memory which is still referenced
by some word.
So, if you close your window, but you have set a word
to one of your buttons (or fields etc.) in that window, then
the window will not be freed because the button's 'parent
facet will be referring to the window.
eg.
lay: layout [
b: button
]
(Layout sets b/parent to lay.)
If you do this:
unset 'lay
recycle
lay is still referred to via b/parent.
Therefore, you need to also:
unset 'b
recycle
I haven't checked this. 'lay and 'b may be
referenced elsewhere in the view/VID system
(and so would not be freed).
For another example, if you use 'load-image
to load some images, they will not be recycled
because there is a reference to them in the
image cache that load-image maintains.
(See the source.)
I almost never use recycle.
The recycler is automatically on by default, so you
shouldn't have to think about it unless you have
special circumstances.
To free all the memory you must try to unset
all the words which you have set running the
program.
A few people here know how to check the words
before and after running a program and can
get the difference (ie. the words that were set).
Check out this cool memory information program by DocKimbel.
http://rebol.dhs.org/mem-watch.r
I've never more than tinkered with it but I am glad it's
there in case I need it some day.
Good questions, by the way.
Anton.
[3/3] from: louisaturk:eudoramail at: 16-Apr-2002 17:39
Anton,
Thanks. I guess I was hoping for some way to unset all the variables with
one word. :>)
Louis
At 12:29 AM 4/17/2002 +1000, you wrote: