Memory benefit from subroutines [message #55328] |
Fri, 10 August 2007 10:24 |
MarioIncandenza
Messages: 231 Registered: February 2005
|
Senior Member |
|
|
Hi IDL Wizards,
This has come up a few times, and I realized I don't know the answer:
In the process of eliminating loops, I write a lot of routines that
hover at the raw edge of what can be done in 32-bit IDL, in terms of
memory usage. When a complicated routine runs out of memory, I usually
do a
IDL> help
to determine if there's any cleanup I failed to do that could
alleviate the crunch. Sometimes, though, the big memory hogs are
outside the current loop. Here's pseudocode for that:
outputarray=fltarr(2,10,2e6); 2e6 data from 200 files
for ifile=0,199 do begin
<crazy memory intensive operation>
outputarray[i,ii,*]=result_1file
endfor
Now, if I put <crazy memory intensive operation> into a FUNCTION,
would I gain any headroom on memory, because of descoping OUTPUTARRAY?
Thanks for your sagacity,
--Edward H.
|
|
|