Bug 39940 - Unmanaged memory leaks detected by valgrind
Summary: Unmanaged memory leaks detected by valgrind
Status: NEW
Alias: None
Product: Runtime
Classification: Mono
Component: General ()
Version: 4.2.0 (C6)
Hardware: All Linux
: --- normal
Target Milestone: ---
Assignee: Bugzilla
Depends on:
Reported: 2016-03-28 07:31 UTC by Matt Z
Modified: 2016-04-25 22:27 UTC (History)
2 users (show)

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

Valgrind memcheck output (5.79 MB, text/plain)
2016-03-28 07:31 UTC, Matt Z

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 for Bug 39940 on GitHub or Developer Community if you have new information to add and do not yet see a matching new report.

If the latest results still closely match this report, you can use the original description:

  • Export the original title and description: GitHub Markdown or Developer Community HTML
  • Copy the title and description into the new report. Adjust them to be up-to-date if needed.
  • Add your new information.

In special cases on GitHub you might also want the comments: GitHub Markdown with public comments

Related Links:

Description Matt Z 2016-03-28 07:31:47 UTC
Created attachment 15534 [details]
Valgrind memcheck output

We are experience major unmanaged memory leaks (3 GB in 10 hours) for our Linux backend service running on Mono 4.2.2. The managed heap stays consistent around 50 MB. I am using valgrind to find the source(s), but it reported so many leaks that I'm not sure which are real and which are false positives.

Zoltan Varga provided a fix for one of the leaks I mentioned on the mono-devel mailing list (http://lists.ximian.com/pipermail/mono-devel-list/2016-March/043575.html), but after applying it, over 19,000 instances of leaked memory are still reported after just starting up our app and letting it sit idle for a couple minutes.

I've attached the latest valgrind output file.
Comment 1 Matt Z 2016-04-25 22:27:49 UTC
Most of these valgrind issues have now been resolved in Mono 4.4, and so this issue can be closed. This turned out to only accounted for a small amount of our service's overall memory leak.

The actual issue that is causing us to grow so large so quickly looks to be a Mono bug in not GC'ing DynamicMethods fully and a new issue has been submitted: https://bugzilla.xamarin.com/show_bug.cgi?id=40691