I am not exactly sure why that is; I would have assumed that the gc collects the objects. A modified version of your test has the same results, see dotnetfiddle.net/5teY0S. People always point out how C# garbage collection is non-deterministic, etc. But I would have assumed that an explicit collect() call causes all non-accessible objects to be reliably collected. Apparently not.
↧