I am using spark-shell
and Scala. Is it possible to delete a variable from the shell's memory namespace?
For example, if I create variables like this:
val foo = 1
var bar = 2
Would it be possible to delete foo
and bar
from memory?
I know that in Python (using del
) and R (using rm
), you can delete specific variables from the namespace (aka environment or workspace).
Unfortunately, you cannot delete a specific variable in Scala REPL.[1] What you can do is assigning a new value to override an existing variable. Scala REPL also provides a command :reset
to remove all variables.
[1] Investigating memory leaks in the Spark Shell: https://gist.github.com/dragos/77b048c2baba93d36cd8
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With