Bug 30849 - Memory leak in AppDomain
Summary: Memory leak in AppDomain
Status: RESOLVED FIXED
Alias: None
Product: Runtime
Classification: Mono
Component: General (show other bugs)
Version: 4.0.0
Hardware: PC Linux
: --- normal
Target Milestone: ---
Assignee: Alexander Kyte
URL:
Depends on:
Blocks:
 
Reported: 2015-06-05 11:36 UTC by smallwill
Modified: 2017-10-06 20:29 UTC (History)
5 users (show)

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


Attachments

Description smallwill 2015-06-05 11:36:18 UTC
$ mono --version
Mono JIT compiler version 4.0.1 (tarball Thu May 28 09:08:28 UTC 2015)
Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
	TLS:           __thread
	SIGSEGV:       altstack
	Notifications: epoll
	Architecture:  amd64
	Disabled:      none
	Misc:          softdebug 
	LLVM:          supported, not enabled.
	GC:            sgen



The following simple code result in a memory leak (growing memory usage over time in task manager):

for (var i = 0; i < 10000; i++) 
{
var appDomain = AppDomain.CreateDomain(i.ToString());
AppDomain.Unload (appDomain);
GC.Collect ();
GC.WaitForPendingFinalizers ();
}
Comment 1 Alexander Kyte 2015-06-08 19:04:35 UTC
The master branch on mono didn't exhibit this space leak when I tried to reproduce.

~/mono/mono (appdomain_leak*) $ mono --version
Mono JIT compiler version 4.3.0 (appdomain_leak/8b466ec Mon Jun  8 18:20:28 EDT 2015)
Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
	TLS:           normal
	SIGSEGV:       altstack
	Notification:  kqueue
	Architecture:  amd64
	Disabled:      none
	Misc:          softdebug
	LLVM:          supported, not enabled.
	GC:            sgen

http://i.imgur.com/FoKrIdO.png
Comment 2 Alexander Kyte 2015-06-09 17:20:14 UTC
Is this on linux or on OSX?
Comment 3 smallwill 2015-06-10 04:27:49 UTC
This is on lubunutu 14.04
Comment 4 Alexander Kyte 2015-06-11 18:03:06 UTC
It looks like we're leaking all of our generic method headers.
Comment 5 Alexander Kyte 2015-06-22 11:46:14 UTC
https://github.com/mono/mono/pull/1880
Comment 6 Zoltan Varga 2017-04-13 02:14:35 UTC
I can still repro this on osx with master -> REOPEN.
Comment 7 Zoltan Varga 2017-04-13 04:47:03 UTC
Fixed some newly added leaks in:
https://github.com/mono/mono/pull/4685

Note You need to log in before you can comment on or make changes to this bug.