RE: [REBOL] Deleting / Unsetting Hierachical Objects / Faces
---releasing objects:

Usually dont reference it and let gc do the work.

but functions hold the arguments of their last call in current rebol.
its freed when they are called again.
with few large objects this is wastefull.
clearing the tops levels of such a object/block might help.

also there is 'load-image, which keeps a cache with all
loaded images and looks there first.
i expect rebol uses it internal.
it has an option /clear to clear it.

---for referencing:

why don't you use objects of objects?
even if thats one-field objects like
 make object![value: something]
this style is used in /view everywhere
(like writing face/text the long way.. instead of hacking to use the 'text somehow).

-volker

[EMAIL PROTECTED] wrote:
> 
> Hi All,
> 
> At present I am working on a bit of code that encapsulates over 300 faces
> into a single context.  Unfortunately since these faces are all ordered in
> an object-like manner and some have timers involved, doing a mass delete of
> the object is not always giving expected results and memory is not being
> released until the script ends - this gets to be an issue once the 65MB
> object is re-loaded a few times...
> (Am expecting on average about 1000 - 2000 reloads of the object as it is
> part of a game interface, also the test scripts and associated files are
> over 5MB compressed so they wont be sent anywhere in a hurry ;-) )
> 
> First I defined an object called desktop that is simply a screen-wide face
> (yes - i know this overrides the internal desktop command in view).
> To desktop/pane I append the my-object/my-top-face (which by default
> includes all its subfaces and animations).
> 
> Then to test memory release I added a button to desktop (see below) to
> release my-top-face from the desktop and kill my-object like so:
> =>  button "Remove Object" [remove find desktop/pane my-object/my-top-face
> my-object: copy []]
> ;I also tried unset 'my-object in the remove button - but this did not
> affect sub-faces and timers
> 
> Next I added a button to call in the %my-context-object.r file which creates
> the my-object and appends its my-object/my-top-face to the desktop.
> =>  button "Add Object" [do %my-context-object.r show desktop]
> (code from %my-context-object.r is merely an append desktop/pane
> my-top-face)
> 
> What I need to know is:
> 1) How do I properly delete huge multi-level objects (please don't say
> property by property...)
> 2) How do I make sure that all memory is reclaimed (ie trigger garbage
> collection manually) - provided this is not already covered by step 1.
> 
> 
> Thanks :)
> 
> 
> James.
> 
> 
> -- 
> To unsubscribe from this list, please send an email to
> [EMAIL PROTECTED] with "unsubscribe" in the 
> subject, without the quotes.
> 
-- 
To unsubscribe from this list, please send an email to
[EMAIL PROTECTED] with "unsubscribe" in the 
subject, without the quotes.

Reply via email to