Where does the memory go?

Dennis Brown see3d at writeme.com
Thu Jun 30 22:43:36 EDT 2005


On Jun 30, 2005, at 7:23 PM, Richard Gaskin wrote:

> Dennis Brown wrote:
>
>> Hi all,
>> I have been using custom properties and custom properties sets to   
>> store results from different data analysis.  This requires me to   
>> delete the properties of the last run before proceeding with the  
>> next  run.  There are many many automatically generated properties  
>> in the  sets.  I started to wonder what happens to the memory when  
>> I delete a  key.  The properties can no longer be seen because the  
>> key is gone,  but what about the memory space.  Does Rev garbage  
>> collect the space  to recover it?  I am concerned that I will  
>> create this huge legacy of  garbage memory structures that will  
>> continue to grow as my program is  run and saved over many months.
>> Can anyone verify that the program memory space will be recovered?
>>
>
> Another way to ask that question would be to pose it as its  
> corollary: do we have evidence of memory leaks in Rev?
>
> There may be, but it seems not too difficult to test:  make a  
> project that adds and deletes large sets of custom props and  
> objects containing large amounts of data, check the memory usage  
> before it starts, let it run all night, and check it again in the  
> morning.
>
> --
>  Richard Gaskin
>  Managing Editor, revJournal
>  _______________________________________________________
>  Rev tips, tutorials and more: http://www.revJournal.com
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your  
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution
>

Richard,

I did just that.  I made a button with the following quickly thrown  
together script and ran it, stopping it every so often to save the  
stack and check the size.  The good news is that the rather large set  
of properties and data (210MB) was created and deleted each pass  
(only took a few seconds per pass) resulted in not even a single byte  
change in stack size between passes.  Thanks for the suggestion.  Now  
I can sleep tonight!

BTW: The technique below is how I finally figured out how to have  
multi-dimensional arrays saved as properties that can be directly  
addressed by variables without using the do command.  Really no  
difference between array[x,y] and array[x&"x"&y&"y"]  or something  
similar as far as keys go --a unique key is generated for each  
element in either case.

Dennis

ON mouseUp
     local k,key,stuff
     set the textColor of me to "red"
     REPEAT 1000 times
         put "A nice line to repeat"&cr after stuff
     END repeat
     --
     REPEAT forever
         set the customPropertySet of me to "Data" --also creates the  
set if it does not exist
         put the customKeys of me into k --delete the old set of  
preferences for "mySet"
         get empty
         REPEAT for each line key in k
             IF key contains "mySet" THEN next repeat
             put key&cr after it
         END repeat
         set the customKeys of me to it
         set the customPropertySet of me to empty
         IF the mouseClick THEN if the clickLoc is within the rect of  
me THEN exit repeat
         --generate a lot of keys with a lot of data
         REPEAT with y=1 to 100 --Y values
             REPEAT with x=1 to 100 --X values
                 -- save the whole Stats for each point in the result  
matrix
                 set the Data["mySet"&x&"x"&y&"y"] of me to stuff
             END repeat
         END repeat
         --        set the Data["Passes"] of me to 0
         get the Data["Passes"] of me
         add 1 to it
         set the Data["Passes"] of me to it
         put "Pass"&&it
     END repeat
     set the textColor of me to "black"
END mouseUp




More information about the use-livecode mailing list