18
$\begingroup$

Bug introduced in 10.0.2 or earlier and fixed in 10.1.0


Whenever I plot something 3 temporary variables get added to my current context.

Example (fresh Kernel):

Plot[x, {x, -1, 1}]; Names["Global`*"] 

Output:

{"x", "$3", "$4", "$5"} 

When I do the same thing 100 times it adds 300 temporary vars in total.

Do[Plot[x, {x, -1, 1}], {100}]; Names["Global`*"] // Length 

Output:

301 

This is probably not a big issue for plots inside a notebook. However, if a function relies on plot (like FindAllCrossings) wouldn't the function pollute it's context if it is called repeatedly?

I wondered if this would slow down calls to other objects in that context (if for example 10000 temporary variables had been added).

So I'd just like to know whether my observations are correct or whether I'm totally on the wrong track here.

$\endgroup$
6
  • 3
    $\begingroup$ What a coincidence! I reported this to WRI about 10 minutes before you posted. But I didn't realize that it was Plot that did it. I was blaming the summary boxes from InterpolatingFunction. $\endgroup$ Commented Nov 21, 2014 at 19:25
  • 5
    $\begingroup$ This only happens in v10, not v9 or v8. $\endgroup$ Commented Nov 21, 2014 at 19:33
  • 1
    $\begingroup$ I'm provisionally tagging this as a bug, since I do not think this is desired behavior. $\endgroup$ Commented Jul 4, 2015 at 5:13
  • 1
    $\begingroup$ @Szabolcs This happens in 10.0.2 but not 10.1.0. Do you know when it was introduced? $\endgroup$ Commented Jul 4, 2015 at 5:54
  • $\begingroup$ Maybe related: (58375), (64394) $\endgroup$ Commented Jul 4, 2015 at 5:56

1 Answer 1

3
$\begingroup$

Answering to drop this off the list.

This still works in 10.2:

In[18]:= Remove["Global`*"] Plot[y, {y, -1, 1}]; Names["Global`*"] Out[20]= {"y"} 
$\endgroup$

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.