How to clear variables and/or whole work space


#1

hello ,i’m a newcomer. i use Atom as my IDE for julia . How to clear the information in REPL and the variables that i do not need in the work space


#2

I don’t use Atom but in Julia 0.6 REPL, you can use the workspace() function to clear things up.

julia> a = 1
1

julia> a
1

julia> workspace()

julia> a
ERROR: UndefVarError: a not defined

#3

Note that workspace is gone in 0.7, so going forward the only way to clear your workspace is to quit and restart Julia.


#4

I think you can replace your variables with nothing and then garbage collect.

The following shows what I mean:

testbig=rand(10_000,10_000)
testbig=nothing;
gc()

#5

But then the binding still exists.


#6

Is that harmful?


#7

Depends on what you want, just saying it’s different from the behavior of workspace().


#8

Using workspace() in Juno is a bad idea and will break all sorts of things, so I’d really advise against it.

You can clear the REPL display with Ctrl-J Ctrl-C or by typing clearconsole() into the REPL, however.


#9

thank u all very much . i got it.