Is garbage collection broken in version 10.0.0?

13

4

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

Posted 2014-08-28T15:58:05.657

Reputation: 259 163

1I 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 – 2014-08-28T16:03:28.377

8That's a known bug. – user21 – 2014-08-28T16:21:26.473

5The 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 – 2014-08-28T17:26:18.490

Answers

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

Posted 2014-08-28T15:58:05.657

Reputation: 32 260

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 – 2014-09-17T06:13:28.673

@rm-rf. I don't see {foo$} no matter how many times I evaluate the first cell. – RunnyKine – 2014-09-17T08:07:54.053

In MMa 8.0.4 in the both cases I get empty list {}. – Alexey Popkov – 2014-10-21T04:13:05.890

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 – 2014-10-21T04:27:54.333

Have you reported it? – Alexey Popkov – 2014-10-21T04:31:41.743

@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 – 2014-10-21T05:21:25.157

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 – 2014-10-21T08:57:14.687

@AlexeyPopkov. I'm on 64bit Windows. Both Windows 8.1 and Windows 10TP give the same result. – RunnyKine – 2014-10-21T12:37:37.003

@AlexeyPopkov Empty lists in both cases for me also with v.10.0.2 and OS X 10.9.5 – SquareOne – 2015-01-15T01:15:21.557