Re: Deallocate Memory for a Structure [message #45804] |
Sat, 15 October 2005 04:07 |
Armando Riccardi
Messages: 1 Registered: October 2005
|
Junior Member |
|
|
andrew.cool@dsto.defence.gov.au wrote:
> Robert Moss wrote:
>
>> Reimar Bauer wrote:
>>
>>> a=create_Struct('test',1)
>>> a=0
>>>
>>> or
>>>
>>> dummy=temporary(a)
>>>
>>
>> dummy = temporary( a ) does not free any memory. It simply renames the
>> variable that contains the structure. Setting a to zero certainly does
>> work.
>>
>>
>> --
>> Robert Moss, PhD
>
>
> But, if you place dummy=temporary(a) in a procedure, it does free up
> memory - see DF's tip at
> http://www.dfanning.com/tips/variable_undefine.html
>
> Andrew
>
The correct command is:
dummy=size(temporary(a))
that deallocate memory.
Armando
|
|
|
|
Re: Deallocate Memory for a Structure [message #45806 is a reply to message #45805] |
Fri, 14 October 2005 21:46  |
Robert Moss
Messages: 74 Registered: February 1996
|
Member |
|
|
Reimar Bauer wrote:
>
> a=create_Struct('test',1)
> a=0
>
> or
>
> dummy=temporary(a)
>
dummy = temporary( a ) does not free any memory. It simply renames the
variable that contains the structure. Setting a to zero certainly does
work.
--
Robert Moss, PhD
|
|
|
|
Re: Deallocate Memory for a Structure [message #45812 is a reply to message #45811] |
Fri, 14 October 2005 00:06  |
R.Bauer
Messages: 1424 Registered: November 1998
|
Senior Member |
|
|
Archais wrote:
> I am reading data files in IDL into a structure that was defined by
> ascii_template. Once the data is loaded, the structure is fairly
> large. The data files are organized in days and I have the data
> loading routine in a loop over the number of days in a year so that the
> same structure gets written over with a new day's data for each
> iteration. The program starts out fine, loading the data fairly
> quickly, but the program begins slowing down gradually. I'm pretty
> sure its a memory issue, but I can't seem to find any routine that will
> deallocate the memory used by the structure. Is there any such
> routine, and if so what is it?
>
> Thanks
> Archais
>
a=create_Struct('test',1)
a=0
or
dummy=temporary(a)
If you use pointers
a=ptr_new(create_Struct('test',1))
ptr_free,a
Did you have profiled your routine?
cheers
Reimar
--
Reimar Bauer
Institut fuer Stratosphaerische Chemie (ICG-I)
Forschungszentrum Juelich
email: R.Bauer@fz-juelich.de
------------------------------------------------------------ -------
a IDL library at ForschungsZentrum Juelich
http://www.fz-juelich.de/icg/icg-i/idl_icglib/idl_lib_intro. html
============================================================ =======
|
|
|