Bug 310 - Garbage collection is acting differently when run in windows vs. mono on OS X
Summary: Garbage collection is acting differently when run in windows vs. mono on OS X
Alias: None
Product: Runtime
Classification: Mono
Component: GC ()
Version: unspecified
Hardware: All Mac OS
: Normal critical
Target Milestone: ---
Assignee: Bugzilla
Depends on:
Reported: 2011-08-16 20:18 UTC by Andrew Young
Modified: 2014-01-12 01:07 UTC (History)
4 users (show)

Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report on GitHub or Developer Community with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:

Description Andrew Young 2011-08-16 20:18:57 UTC
I have created a memory test available here on github. https://github.com/ayoung/RestSharp/tree/memleak

In the /memtest folder there is a sample project that shows the issue. It is a console app that uses RestSharp to make an http request. I manually added finalizers to objects within RestSharp as well as in the test project so you can see what is being cleaned up and what isn't.

It looks like when the project is run in mono on OS X it does not clean up like it does when run on Windows with the normal .NET runtime.

Here is the output when run on Windows:

33.8146858, -117.9246068
Create the closure with: 0

Here is the output when run in mono on OS X.

ayos-mpb:memtest Andrew$ mono MemTest.exe
33.8146858, -117.9246068
Create the closure with: 0

This causes lots of memory leaks within our real iPhone project using MonoTouch because UI elements are not being cleaned up since these objects hold references through closures and delegates.
Comment 1 Andrew Young 2011-08-17 12:51:42 UTC
I'm using mono 2.10.4
Comment 2 Robert Wilkens 2012-06-22 15:39:17 UTC
I clicked on the github link to check out the sample code, and github gave me a 404 error ("not found").  If this is still an issue, perhaps you can repost the source link to wherever it was updated to, or Perhaps you can attach it to this problem report directly (I think you can upload files to bugzilla - see 'add an attachment' above).

p.s. I'm not claiming i personally will be able to fix it, I've done some fixes and if it is mac specific i do have a mac to build and test on, but i wanted to try to compile the sample so I could see what is going on, I'd like to know if i can reproduce it on Linux (my preferred environment) before i try it on the mac.  Me leaving this comment should add me to the cc: list so whenever you post it i'll see what i can find.
Comment 3 Rodrigo Kumpera 2012-08-30 14:13:18 UTC
Please provide a test case.
Comment 4 Rodrigo Kumpera 2014-01-12 01:07:55 UTC
No news of a test case.