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

Home » Public Forums » archive » Re: delete variable name from memory
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
Re: delete variable name from memory [message #44259] Thu, 02 June 2005 10:21 Go to next message
JD Smith is currently offline  JD Smith
Messages: 850
Registered: December 1999
Senior Member
On Thu, 02 Jun 2005 14:25:46 +0200, David Fanning wrote:

> saplizki@gmail.com wrote:
>
>> I need to delete my variable from the variable name list.
>> but i don't locate at the top level (i'm in a gui program) so i can't
>> 'delvar' it.
>> also i can't (don't want to) zero it because it won't remove from the
>> variable list (when i press help or use ROUTINE_NAMES or ROUTINE_INFO)
>> and i use that list at my program.
>
> Try UNDEFINE:
>
> http://www.dfanning.com/programs/undefine.pro

Note that there is a difference between a deleted variable and an
undefined variable:

IDL> a=12

IDL> help
% At $MAIN$
A INT = 12

IDL> delvar,a

IDL> help
% At $MAIN$

IDL> a=12

IDL> undefine,a
% Compiled module: UNDEFINE.

IDL> help
% At $MAIN$
A UNDEFINED = <Undefined>

IDL> print,routine_info('$MAIN$',/VARIABLES)
A


I.e. the TEMPORARY tricks leave a reference to the variable as
UNDEFINED, whereas DELVAR removes any notion of ever having seen such
a variable. They are equivalent if you are using, e.g., N_ELEMENTS()
eq 0 as a test for a variable's presence, since whether a variable is
non-existent, or exists but is undefined, N_ELEMENTS is 0. An
undefined variable, however, is still a variable, and will show up in
ROUTINE_INFO, among other places.

JD
Re: delete variable name from memory [message #44261 is a reply to message #44259] Thu, 02 June 2005 09:30 Go to previous messageGo to next message
Antonio Santiago is currently offline  Antonio Santiago
Messages: 201
Registered: February 2004
Senior Member
saplizki@gmail.com wrote:
> I need to delete my variable from the variable name list.
> but i don't locate at the top level (i'm in a gui program) so i can't
> 'delvar' it.
> also i can't (don't want to) zero it because it won't remove from the
> variable list (when i press help or use ROUTINE_NAMES or ROUTINE_INFO)
> and i use that list at my program.
>

Another way to undefine a variable different from David's solution is
with pointers:

IDL> .reset
IDL> a=10
IDL> help
% At $MAIN$
A INT = 10
Compiled Procedures:
$MAIN$

Compiled Functions:

IDL> PTR_FREE, PTR_NEW(a, /NO_COPY)
IDL> help
% At $MAIN$
A UNDEFINED = <Undefined>
Compiled Procedures:
$MAIN$

Compiled Functions:

IDL> ...


The important thing is PTR_NEW(a, /NO_COPY) creates a copy of 'a' into
the HEAP memory and undefines 'a' (with NO_COPY keyword) and returns a
pointer variable that "points" to the HEAP memory. Then we free this
pointer variable.

Also, I suposse (better I'm sure) David's solution is much more good
than this because he use the TEMPORARY function that is desigend for a
similar use that you need.

Bye.

--
-----------------------------------------------------
Antonio Santiago P�rez
( email: santiago<<at>>grahi.upc.edu )
( www: http://www.grahi.upc.edu/santiago )
( www: http://asantiago.blogsite.org )
-----------------------------------------------------
GRAHI - Grup de Recerca Aplicada en Hidrometeorologia
Universitat Polit�cnica de Catalunya
-----------------------------------------------------
Re: delete variable name from memory [message #44264 is a reply to message #44261] Thu, 02 June 2005 05:25 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
saplizki@gmail.com wrote:

> I need to delete my variable from the variable name list.
> but i don't locate at the top level (i'm in a gui program) so i can't
> 'delvar' it.
> also i can't (don't want to) zero it because it won't remove from the
> variable list (when i press help or use ROUTINE_NAMES or ROUTINE_INFO)
> and i use that list at my program.

Try UNDEFINE:

http://www.dfanning.com/programs/undefine.pro

Cheers,

David
Re: delete variable name from memory [message #44339 is a reply to message #44259] Sun, 05 June 2005 04:30 Go to previous message
saplizki is currently offline  saplizki
Messages: 4
Registered: June 2005
Junior Member
but i do need to removes any notion of ever having seen such a
variable.
And David's solutions and Antonio's solutions dosn't do it, so how can
i really remove it.
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: goetiff reading routine for idl 5.1
Next Topic: Re: C/C++ conversion to IDL

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

Current Time: Thu Oct 09 22:17:19 PDT 2025

Total time taken to generate the page: 0.00842 seconds