4
$\begingroup$
Needs["Utilities`CleanSlate`"]    
x:= 4    
x    
(*4*)

CleanSlate[]    
(*During evaluation of In[4]:=   (CleanSlate) Contexts purged: {Global`}*)    
(*During evaluation of In[4]:=   (CleanSlate) Approximate kernel memory recovered: 0 Kb*)
(*{"Utilities`CleanSlate`", "PacletManager`", "QuantityUnits`", \ "WebServices`", "System`", "Global`"}*)

x
(*4*)

When I use CleanSlate[] the variable x should be cleared from memory, right? Why does it still remain afterwards?

$\endgroup$
11
  • 3
    $\begingroup$ Quick workaround: You can just Quit instead of using CleanSlate. CleanSlate was relevant when computers were slower and the kernel took a considerable time to start up. Using Quit was annoying at that time. Now kernel startup is fast enough that I just quit when I need a clean slate ... $\endgroup$ – Szabolcs May 13 '14 at 2:52
  • 2
    $\begingroup$ I wouldn't spend too much time on this. As Szabolcs said, using Quit instead is pretty quick. It takes only a few seconds on my PC. $\endgroup$ – Sjoerd C. de Vries May 13 '14 at 5:42
  • 1
    $\begingroup$ @user2612743 Try running the kernel only in command line mode, without reading the init.m file. On your Mac the command to start it would be something like /Applications/Mathematica.app/Contents/MacOS/MathKernel -noinit. Then try again. Does it work? $\endgroup$ – Szabolcs May 13 '14 at 14:28
  • 1
    $\begingroup$ @Szabolcs Ok, I replaced my modified init.m file with the default one and it works fine!! For reference, here is my init.m and underneath is the deafult one: pastebin.com/hnmUC3hG -- Why does the default work but mine not? $\endgroup$ – 1110101001 May 13 '14 at 23:12
  • 1
    $\begingroup$ @user2612743 Sorry, I don't have any good ideas just by looking at it. You can try removing different parts of the init.m to figure out precisely which part is causing this. (Use "binary search", remove half of it first, etc., it shouldn't take more than 3 tries.) $\endgroup$ – Szabolcs May 14 '14 at 0:58
1
$\begingroup$

I found this link that might cure this.

Click here

x:=4
x
(*4*)
Clear["Global`*"]
x
(*x*)
$\endgroup$
1
  • $\begingroup$ The Mathematica package "CleanSlate" is supposed to be more more complete than Clear["Global*"], in that it unloads currently loaded contexts, as mentioned by @Szabolcs in this answer. Can you please explain how or why this should solve OP's problem? $\endgroup$ – dionys Sep 9 '15 at 16:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.