# Is garbage collection broken in version 10.0.0?

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? • 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 • That's a known bug. – user21 Aug 28 '14 at 16:21 • 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 Answer 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$"}  • 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 6:13
• @rm-rf. I don't see {foo\$} no matter how many times I evaluate the first cell. – RunnyKine Sep 17 '14 at 8:07
• In MMa 8.0.4 in the both cases I get empty list {}. – Alexey Popkov Oct 21 '14 at 4:13
• @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 4:27
• Have you reported it? – Alexey Popkov Oct 21 '14 at 4:31