How to release CPU memory from Rebol2
When I view DOM's and web pages with %rebol-dom-mdlparser.r and use the clear, recycle/on off functions or over write loaded data, it seems to have no effect on CPU memory usage. Rebol/view crashes. Is there a way possible to release used memory as I browse or must I use multiple interpreters?
posted by: Inetw3 13-Mar-2021/13:37:41-8:00
The normal way is to set a word to NONE. This removes one reference to the underlying series. When the REBOL garbage collector detects that all references are gone, it can recycle the series. So you must find all references, and set them all to NONE.
CLEAR probably doesn't work, because it only resets the length of a reference, not the content of the underlying series it references.
Overwriting would work if you mean setting all the words that reference the series to some other series, so the references are gone and the collector can recycle it. If you mean putting some other data in the same series, that doesn't work, because it doesn't change the size in memory.
posted by: Kaj 8-May-2021/5:17:26-7:00
Thank you kaj. I never read or heard any way to force a recycle by way of GC through setting something to none. Didn't think that would actually work. I think i could do that. Thanks a lot. I just might be able to build a workable browser interface on top of the Rebol-DOM-Mdlparser. Time to get dereferencing.
posted by: Inetw3 13-May-2021/10:56:59-7:00
I don't remember it documented anywhere. I think I picked it up over the years by looking at code of others and wondering why on earth some people were setting values to NONE, seemingly without reason. :-) I spent a lot of time thinking about how REBOL must work internally, to have a way to reason about these things.
posted by: Kaj 13-May-2021/16:17:18-7:00