[REBOL] Another view recycling problem with images
From: roland::hadinger::arcor::de at: 14-Jun-2003 16:25
I just discovered the life2d.r demo has a problem with the garbage
collector, too.
Hard to explain, so here is a smaller version of the problem and
my preliminary workaround:
REBOL []
;; (tested with REBOL/view 1.2.1 and 1.2.8 on Windows XP Pro).
f1: make face [size: 1x1 edge: none]
f2: make face [size: 1x1 edge: none]
view layout [
box 50x50 rate 1 feel [
engage: func [f a e] [
if a = 'time [
loop 1000 [
f2/image: to-image f1
f1/image: to-image f2
]
loop 1000 [recycle] ; argh !!!!!!!!!!!!
]
]
]
]
The code above runs without crashing.
Now, in the line that is commented with the genuine rendition of
the scream that could be heard throughout my house (the "argh" :),
decrease the loop count to 1 (or even 0) and run the script again.
Much faster now! But after some time, the operating system will
run out of memory and crash.
This line is the workaround, but I don't quite understand it :)
Could anyone explain what I'm missing here?
--
Roland