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$
  • 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$ – Szabolcs Nov 21 '14 at 19:25
  • 5
    $\begingroup$ This only happens in v10, not v9 or v8. $\endgroup$ – Szabolcs Nov 21 '14 at 19:33
  • 1
    $\begingroup$ I'm provisionally tagging this as a bug, since I do not think this is desired behavior. $\endgroup$ – J. M. will be back soon Jul 4 '15 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$ – Mr.Wizard Jul 4 '15 at 5:54
  • $\begingroup$ Maybe related: (58375), (64394) $\endgroup$ – Mr.Wizard Jul 4 '15 at 5:56
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$

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.