Re: Release memory?
- Posted by Derek Parnell <ddparnell at bigpond.com> Sep 18, 2002
- 550 views
>From my understanding, this action will only "release" memory for the application to reuse, it will not release memory for other applications. Each time a Euphoria program need more memory for a sequence operation, the memory is taken from the program's heap, but if the heap is not large enough the program grabs a bit more RAM from the operating system (thus increasing the size of th eprogram's heap), and the heap is not returned until the program ends. This also applies to allocate() and allocate_string() calls. It does not apply to the Win32lib memory allocation routines, as these return freed heap allocations back to Windows - thus allowing them to be used by other Windows programs. ---------------- cheers, Derek Parnell ----- Original Message ----- From: <r.schr at t-online.de> To: "EUforum" <EUforum at topica.com> Sent: Thursday, September 19, 2002 5:21 AM Subject: Re: Release memory? > > Juergen Luethje wrote: > > > > > > Hi all, > > > > I've got a question about sequences. For instance, assume the following > > code: > > > > ----------------------------------- > > include file.e > > object list > > sequence file_list, entry > > > > file_list = {} > > list = dir("test.*") > > if sequence(list) then > > for i = 1 to length(list) do > > entry = list[i] > > if not find('d', entry[D_ATTRIBUTES]) then > > file_list = append(file_list, entry[D_NAME]) > > end if > > end for > > 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? > > Hi Juergen, > > why you don't put this code into a function and return only length(...)? > After leaving the function, all private variables should be freed?! > > Have a nice day, Rolf > > > >