Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

[REBOL] Re: Memory usage

From: Christophe:Coussement:mil:be at: 19-Oct-2005 9:41

Hi list, I did also have a lot of trouble with REBOL garbage collecting strategy. Assuming 'recycle would work like a C deallocation function, I used it a lot into some of my resources-consuming scripts. But one day I stated the following:
>> stats
== 4183470
>> my-string: make string! 10000000
== ""
>> stats
== 13186209 ;-> + 10MB
>> recycle >> stats
== 13186065 ;-> Gee! Didn't work at all ??? After a few try-and-errors, I found that first using a 'make on the word previously to the call to 'recycle, solves the problem: (...continuing previous code snippet)
>> my-string: make none! none
== none
>> stats
== 13186577 ;-> just checking: nothing happened
>> recycle >> stats
== 3185714 ;-> memory obviously freed You do not have to use a 'make none! To achieve this: a call to 'make string! "" or whatever does the job too. I solve most of my memory problem using this 'free-memory function: free-memory: func ['w][set :w make none! none recycle] You can find an interesting thread about this subject on the French REBOL forum: http://www.codeur.org/forum/message.php?ID_Sujet=2500 Now, I do not know if this is the regular use of 'recycle, as meant by RT. Or if this is a buggy thing... Perhaps have the list's gurus some thoughts about that? Anyway, I hope this will help :-) ==christophe