TEMPORARY (was Re: Fragmented memory with IDL) [message #1038] |
Fri, 21 May 1993 14:24 |
jdlb
Messages: 11 Registered: July 1992
|
Junior Member |
|
|
thompson@serts.gsfc.nasa.gov (William Thompson) writes:
> Another way to avoid memory fragmentation is to use the TEMPORARY function
> where appropriate.
The TEMPORARY function can be useful, but caution is required as TEMPORARY
*deletes* the original array. Thus,
IDL> a = temporary(a) + 1
adds 1 to A using a minimum of memory, but
IDL> b = temporary(a) + 1
creates B while destroying A. This may be obvious to others, but it burned me
the first time.
TEMPORARY, whose effects are PERMANENT, might perhaps be more aptly named
COPY_AND_DELETE. :^)
Regards,
Jeff
% Jeff de la Beaujardiere % jdlb@mamane.ifa.hawaii.edu %
% Institute for Astronomy % 808-956-9843 %
% University of Hawai`i % fax 956-9402 %
|
|
|