Re: Release memory?

new topic     » goto parent     » topic index » view thread      » older message » newer message

On Wed, 18 Sep 2002 20:46:02 +0200, Juergen Luethje <jluethje at gmx.de> 
wrote: 
 
>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? 
 
The short answer is use local variables to the function/procedure 
where possible. If that is not practical, and they are big, then yes. 
Small things just tend to end up in the swap file and cause no further 
problems. 
 
In one case (file comparison) I had: 
seq loca, locb 
func, 
proc, 
func, 
... 
global procedure(seq a,seq b) 
	loca=a locb=b	-- kinda need them global 
 
where a & b were the entire contents of the files I was comparing, so 
rather than pass them to each & every local procedure & function, as 
above I [lazily] made local "copies" of them. 
 
In the above include file, loca & locb took near zero space (just 
pointers to a & b), despite a and b themselves being rather large. 
However, I found that coding a={} and b={} in the calling procedure 
then had no effect but adding loca{} and locb{} at the end of the 
include file improved things quite a bit. 
 
So, in summary, often it makes no odds, but if you need to do it make 
sure there are no other references to the variable contents. 
 
Pete 
PS it also makes your ex.err alot smaller.

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu