is there a way to delete global variables?

B

bennys

Guest
once a variable is defined (for example by a=5)
is there a way to remove it from the memory without exiting cadence?
(after which an error "*Error* toplevel: undefined variable - a" should
appear in the CIW when trying to access the variable a)
 
On 31 Oct 2005 04:14:09 -0800, "bennys" <bennys@il.ibm.com> wrote:

once a variable is defined (for example by a=5)
is there a way to remove it from the memory without exiting cadence?
(after which an error "*Error* toplevel: undefined variable - a" should
appear in the CIW when trying to access the variable a)
a='unbound

would do it.

Andrew.
 
is there a way to remove it from the oblist?

gc() - doesn't seem to help...

Andrew Beckett wrote:
On 31 Oct 2005 04:14:09 -0800, "bennys" <bennys@il.ibm.com> wrote:


once a variable is defined (for example by a=5)
is there a way to remove it from the memory without exiting cadence?
(after which an error "*Error* toplevel: undefined variable - a" should
appear in the CIW when trying to access the variable a)


a='unbound

would do it.

Andrew.
 
On Mon, 31 Oct 2005 09:48:47 -0600, Trevor Bowen <m27315@gmail.com> wrote:

is there a way to remove it from the oblist?

gc() - doesn't seem to help...
No. Once a symbol is in the symbol table, it's there until you exit. Note, a
variable does not have to be created for something to end up in the oblist -
doing:

a='someSymbol

will put someSymbol in the symbol table (note, oblist is really a mirror of the
internal symbol table, in list form). There is no garbage collection of symbols,
which is why you should be very careful about using symbols as dynamic data
structures.

That said, doing something like this:

a=myVar

will also put myVar in the symbol table, with a value of unbound. So it's no
different having an uninitialised variable than a variable which has been set to
unbound.

The amount of saving (in normal situations) by removing a symbol from the symbol
table is likely to be very small, so there is little benefit in doing this.

Regards,

Andrew.
 
Thanks for the insight, Andrew!

Andrew Beckett wrote:
On Mon, 31 Oct 2005 09:48:47 -0600, Trevor Bowen <m27315@gmail.com> wrote:


is there a way to remove it from the oblist?

gc() - doesn't seem to help...




No. Once a symbol is in the symbol table, it's there until you exit. Note, a
variable does not have to be created for something to end up in the oblist -
doing:

a='someSymbol

will put someSymbol in the symbol table (note, oblist is really a mirror of the
internal symbol table, in list form). There is no garbage collection of symbols,
which is why you should be very careful about using symbols as dynamic data
structures.

That said, doing something like this:

a=myVar

will also put myVar in the symbol table, with a value of unbound. So it's no
different having an uninitialised variable than a variable which has been set to
unbound.

The amount of saving (in normal situations) by removing a symbol from the symbol
table is likely to be very small, so there is little benefit in doing this.

Regards,

Andrew.
 

Welcome to EDABoard.com

Sponsor

Back
Top