Re: Release memory?
- Posted by Robert Craig <rds at RapidEuphoria.com> Sep 19, 2002
- 562 views
Rolf Schroeder writes: > I run lots of EU-programs on a WinNT machine, and when I watch > the memory consumption of each program, then I watch during > one inner program loop increasing and decreasing memory consumption > which means in my opinion that memory is returned to the OS > (I don't use allocate() and free()). > > But the true expert (about the lots of experts on the list) is Rob. Rob? The Euphoria interpreter and translator both use C's malloc() and free(). These do not give memory back to the operating system. The memory that they manage is returned when the process terminates. Perhaps you are not monitoring the total virtual memory used, but rather the amount of memory that's actually in RAM (not paged out to disk by the O/S) from one moment to the next. Juergen Luethje writes: > ... > list = {} -- ? > entry = {} -- ? > end if > ? length(file_list) > If I don't use 'list' and 'entry' any more in the rest of the program, > is it a good idea to assign empty sequences to them in order to release > memory? When you assign {}, if there are no other references to the data, the space will be returned to the heap. This will make the space available for new sequences (or floating-point numbers) that you might create in the future. Note that private variables of a routine are freed automatically when the routine returns. If your program is not at risk of running out of memory, there is nothing to be gained by assigning {}. It will just confuse the reader of your program. Regards, Rob Craig Rapid Deployment Software http://www.RapidEuphoria.com