comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » delvar v/s reset_session
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
delvar v/s reset_session [message #22099] Mon, 23 October 2000 00:00 Go to next message
kashyap is currently offline  kashyap
Messages: 26
Registered: April 1993
Junior Member
Puzzle: Somehow, using .RESET_SESSION in between DELVARs seems
to confuse the IDL environment. Now, I believe using DELVAR
inside even a main program is frowned upon (I don't know why),
but this seems very bizarre.

Here's a simple test program:

> cat test.pro
a=1 & b=2 & c=3
print,a,b,c
delvar,a,b
end

and running it repeatedly, resetting the session in between,
quickly starts producing garbage. Whose fault is this --
DELVAR's, .RESET_SESSION's, or mine?

IDL> print,!version
{ sparc sunos unix 5.3 Nov 11 1999}
IDL> .run test
% Compiled module: $MAIN$.
1 2 3
IDL> .reset_session
IDL> .run test
% Compiled module: $MAIN$.
1 3 3
IDL> .reset_session
IDL> .run test
% Compiled module: $MAIN$.
3 2 3
% Internal error: Deleting variable.
% Execution halted at: $MAIN$ 4 /fubar/SCAR/pro/.undone/test.pro
IDL>

Any idea what's going on?

Thanks,
Vinay

--
____________________________________________________________ __________________
kashyap@head-cfa.harvard.edu 617 495 7173 [CfA/P-146] 617 496 7173 [F]
Re: delvar v/s reset_session [message #22176 is a reply to message #22099] Wed, 25 October 2000 00:00 Go to previous message
kashyap is currently offline  kashyap
Messages: 26
Registered: April 1993
Junior Member
Thanks Pavel. However, I think I've narrowed the problem down to
an even more bizarre phenomenon. Try these commands in sequence
(not in a program, but on the command line):

a=1 & b=2 & print,a,b
help
delvar,a
help
.reset_session
help
a=1 & b=2 & print,a,b
help

Is it fair to conclude that you should not use .RESET_SESSION if
you've ever used DELVAR during the session?

Here's a log of what happens in my case:-

IDL> print,!version
{ sparc sunos unix 5.3 Nov 11 1999}
IDL> a=1 & b=2 & print,a,b
1 2
IDL> help
% At $MAIN$
A INT = 1
B INT = 2
Compiled Procedures:
$MAIN$

Compiled Functions:

IDL> delvar,a
IDL> help
% At $MAIN$
B INT = 2
Compiled Procedures:
$MAIN$

Compiled Functions:

IDL> .reset_session
IDL> help
% At $MAIN$
Compiled Procedures:
$MAIN$

Compiled Functions:

IDL> a=1 & b=2 & print,a,b
% PRINT: Variable is undefined: A.
% Execution halted at: $MAIN$
IDL> help
% At $MAIN$
A UNDEFINED = <Undefined>
B INT = 2
B INT = 2
B INT = 2
B INT = 2
B INT = 2
B INT = 2
B INT = 2
B INT = 2
B INT = 2
B INT = 2
B INT = 2
B INT = 2
B INT = 2
B INT = 2
B INT = 2
B INT = 2
B INT = 2
B INT = 2
B INT = 2
< Press Spacebar to continue, ? for help >

-Vinay

In article <39F5AEC3.699E3A3D@cmdl.noaa.gov>,
Pavel Romashkin <promashkin@cmdl.noaa.gov> wrote:
> All I can say is that the following was found in the IDL online help:
>
> The DELVAR procedure deletes variables from the main IDL program level.
> DELVAR frees any memory used by the variable and removes it from the
> main program's symbol table. The following restrictions apply:
> 1. DELVAR can only be called from the main program level.
> 2. Each time DELVAR is called, the main program is erased. Variables
> that are not deleted remain unchanged.
>
> Maybe, you should not use DELVAR in your code. If you worry about the
> size of temporary variables, you can un-define them using TEMPORARY or
> re-assign them to 0B.
> Cheers,
> Pavel
>
> "Vinay L. Kashyap" wrote:
>>
>> Puzzle: Somehow, using .RESET_SESSION in between DELVARs seems
>> to confuse the IDL environment. Now, I believe using DELVAR
>> inside even a main program is frowned upon (I don't know why),
>> but this seems very bizarre.r


--
____________________________________________________________ __________________
kashyap@head-cfa.harvard.edu 617 495 7173 [CfA/P-146] 617 496 7173 [F]
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: IDL/Wave alternatives
Next Topic: NO MORE GIF READ OR WRITE IN IDL 5.4

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 18:40:09 PDT 2025

Total time taken to generate the page: 0.00631 seconds