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 =3D=3D 4183470 >> my-string: make string! 10000000 =3D=3D "" >> stats =3D=3D 13186209 ;-> + 10MB >> recycle >> stats =3D=3D 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 =3D=3D none >> stats =3D=3D 13186577 ;-> just checking: nothing happened >> recycle >> stats =3D=3D 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=3D2500 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 :-) =3D=3Dchristophe =20 -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Ladislav Mecir Sent: Wednesday 19 October 2005 8:42 To: [EMAIL PROTECTED] Subject: [REBOL] Re: Memory usage Peter Carlsson napsal(a): >Gregg Irwin wrote: > =20 > >>Hi Peter, >> >>PC> I have noticed that if I execute a script repeatedly >>PC> I will eventually ran out of memory. I have seen this >>PC> for REBOL/Core on both Linux and Windows and with >>PC> different versions. >> >>PC> I am almost certain that it has to do with my script >>PC> and the way REBOL allocate memory for variables. What >>PC> should I do in my script to clean up before exit? >> >>Can you provide more information about what your script does? Hard to >>say otherwise. >> =20 >> > >Well, it actually is a big program which creates a few >but big lists of text strings. These lists are initially >cleared with 'a-list: copy []'. Is there a better way? >I thought that this would clear any old values and free >that memory. > >Maybe I should do like Sunanda suggested in a previous >email. > >Could I use 'context' for this purpose? > >Best regards, >Peter Carlsson > =20 > Hi Peter, actually I am sure, that there is nothing wrong with (a-list: copy []).=20 It should be sufficient to free previously allocated space for A-LIST. RECYCLE is not meant to be used regularly by users, because the Garbage=20 Collector runs automatically. The best what you can do is to create a=20 simplified version of your script running out of memory, which might=20 reveal a bug either in your code or in the interpreter. -L --=20 To unsubscribe from the list, just send an email to=20 lists at rebol.com with unsubscribe as the subject. -- To unsubscribe from the list, just send an email to lists at rebol.com with unsubscribe as the subject.
