Bug introduced in 10.0.1 and fixed in 10.0.2

In Mathematica 10, the documentation still states that a symbol with attribute Temporary will automatically be removed when it is no longer needed. Now consider

Module[{a}, Information[a]]

=> (* Global\`a$105933 Attributes[a$105933]={Temporary} *)

This a$ variable is not exported from the Module and therefore not needed any more. However, in Mathematica 10 it is not removed:


=> (* {a$105933} *)

This looks like a minor bug to me.

  • 2
    $\begingroup$ According to this post (see the accepted answer) : "One problem with local functions created by Module is that these symbols won't be automatically garbage-collected when Module finishes (if they have DownValues, SubValues or UpValues. OwnValues are fine), and so may lead to memory leaks. To avoid that, one can Clear these symbols inside Module before returning the result." $\endgroup$ – SquareOne Oct 29 '14 at 11:42
  • $\begingroup$ @SquareOne Yes, that is a very good post on localization. But it does not apply here, I did not make a local function. Clearing the variable in the Module should be (and is in earlier versions) superfluous. $\endgroup$ – Fred Simons Oct 29 '14 at 12:02
  • $\begingroup$ Concerning the post, I understood that the problem concerned Symbols in general, not only functions. Anyway, this post dates back to January 2012, so it corresponds to version 8 ?? When you say "earlier versions", what versions are included ? $\endgroup$ – SquareOne Oct 29 '14 at 14:20
  • $\begingroup$ Anyway, OK, I have reproduced your "bug" in version 10.0.1. and not in version 9. However, it seems to be related to the function Ìnformation only (?). If you try the example given in the Doc for Temporary, i.e :Module[{b}, Print[b]; Attributes[b]], and Names["Globalb$*"], the symbol b` was removed ... $\endgroup$ – SquareOne Oct 29 '14 at 14:28
  • $\begingroup$ By the way, just try to enable the Suggestion Bar and do the tests again ... Whether you use Information or no, a new symbol is created in the global context : in your example it is a$, in mine b$. This is true for v9 or v10 ! (This is related to the already reported "Suggestion Bar bug"). $\endgroup$ – SquareOne Oct 29 '14 at 14:42

I have checked it in versions 7.0.1, 8.0.4 and 10.0.1 (the Suggestion bar is turned off). The bug is present only in v.10.0.1, both v.7.0.1 and 8.0.4 return {"a"} after evaluating Names["Global`*"]:


Moreover, if one adds a definition to the symbol a, the definition is not removed in v.10.0.1:

Module[{a}, Information[a]; a = 1];
Symbol /@ Names["Global`*"]
Module[{a = 2}, Information[a];];
Symbol /@ Names["Global`*"]
{a, 1}

{a, 1, 2}

So it seems to be another v10 Module bug.

  • 2
    $\begingroup$ The behaviour has changed for me with v.10.0.2 (OS X 10.9.5) : when adding the defintions, now only {a} is returned (instead of {a, 1} or {a, 1, 2}. $\endgroup$ – SquareOne Jan 15 '15 at 1:12

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.