13

Bug introduced in 10.0.0 and fixed in 10.0.1


In version 10.0.0 under Windows I am observing the following behavior:

Do[Module[{foo}, foo[x_] := 1; foo[0]], {10}]

Names["foo$*"]
{"foo$593", "foo$594", "foo$595", "foo$596", "foo$597", "foo$598",
 "foo$599", "foo$600", "foo$601", "foo$602"}

I am aware that in past versions Module Symbols were sometimes not garbage collected but never in such a simple case as this as far as I know. The code above returns {} in version 7, as one would expect.

Do I have something wrong with my configuration or is this behavior reproducible?
Assuming the latter is there an explanation for this other than a bug?

Mr.Wizard
  • 271,378
  • 34
  • 587
  • 1,371
  • 1
    I get the same behavior on OS X 10.9 with Mathematica 10.0.0. Using Mathematica 9.0.1.0 I get an empty list. – Tyilo Aug 28 '14 at 16:03
  • 8
    That's a known bug. – user21 Aug 28 '14 at 16:21
  • 5
    The interesting question is if 10.0.0 is more buggy than 9.0.0 was. I rarely use 10.0.0. Both kernel and FrontEnd are inferior to 9.0.1 (where comparable). Of course there are some exciting new features in 10, but I just wait for 10.0.1 – Rolf Mertig Aug 28 '14 at 17:26

1 Answers1

5

This bug is fixed in V10.0.1.0 but the behavior is different based on evaluation sequence. If both expressions are in a single cell you get the expected empty list:

Do[Module[{foo}, foo[x_] := 1; foo[0]], {100}];
Names["foo$*"]
{}

If they are evaluated one at a time in different cells you get a single foo$ symbol regardless of how many times the Do loop is evaluated:

Do[Module[{foo}, foo[x_] := 1; foo[0]], {1000}]

Then evaluate

Names["foo$*"]

you get

{"foo$"}
RunnyKine
  • 33,088
  • 3
  • 109
  • 176
  • I don't have 10.0.1 or Mathematica with me now, but what you're describing doesn't seem unexpected. I think if you re-evaluate the top cell a second time, you should see {"foo$"} in the output. – rm -rf Sep 17 '14 at 06:13
  • @rm-rf. I don't see {foo$} no matter how many times I evaluate the first cell. – RunnyKine Sep 17 '14 at 08:07
  • In MMa 8.0.4 in the both cases I get empty list {}. – Alexey Popkov Oct 21 '14 at 04:13
  • 1
    @AlexeyPopkov. Yeah, that's what you should get but somehow in 10.0.1 on Windows I don't. But on Linux it works fine. – RunnyKine Oct 21 '14 at 04:27
  • Have you reported it? – Alexey Popkov Oct 21 '14 at 04:31
  • @AlexeyPopkov. No I haven't. I'm a little reluctant reporting bugs because all the bugs I reported after v10 was released, none of them was fixed in 10.0.1. Also, this was a bug we reported and it was obviously worked on, yet they didn't test it properly. – RunnyKine Oct 21 '14 at 05:21
  • I just have checked in MMa 10.0.1 under Win7 x64 and get empty lists {} in the both cases. I restarted MMa, repeated everything again and got the same result. Are you under 32-bit or 64-bit version of Windows? – Alexey Popkov Oct 21 '14 at 08:57
  • @AlexeyPopkov. I'm on 64bit Windows. Both Windows 8.1 and Windows 10TP give the same result. – RunnyKine Oct 21 '14 at 12:37
  • @AlexeyPopkov Empty lists in both cases for me also with v.10.0.2 and OS X 10.9.5 – SquareOne Jan 15 '15 at 01:15