[domain] Report domain unloads to the profiler when finalizing the domain.
authorAlex Rønne Petersen <alexrp@xamarin.com>
Sat, 9 Apr 2016 01:57:16 +0000 (03:57 +0200)
committerRodrigo Kumpera <kumpera@gmail.com>
Tue, 19 Apr 2016 21:34:46 +0000 (14:34 -0700)
We would miss the unload event for the root domain because we reported it just
before freeing the domain, by which time the profiler was detached.

mono/metadata/domain.c
mono/metadata/gc.c

index 0d0c20b7c6288e4102e2629d558ca1b81228863f..fa2514b9814b088d8748494a51fda80edc8c2df3 100644 (file)
@@ -1169,12 +1169,6 @@ mono_domain_free (MonoDomain *domain, gboolean force)
        g_slist_free (domain->domain_assemblies);
        domain->domain_assemblies = NULL;
 
-       /* 
-        * Send this after the assemblies have been unloaded and the domain is still in a 
-        * usable state.
-        */
-       mono_profiler_appdomain_event (domain, MONO_PROFILE_END_UNLOAD);
-
        if (free_domain_hook)
                free_domain_hook (domain);
 
index bf02f2892b2e8ff3f8c0f544e2c3a08cf4dfa2b5..3871ee4b0c102ae1081e37bc15e33682915cf21a 100644 (file)
@@ -453,6 +453,8 @@ mono_domain_finalize (MonoDomain *domain, guint32 timeout)
                mono_gc_finalize_threadpool_threads ();
        }
 
+       mono_profiler_appdomain_event (domain, MONO_PROFILE_END_UNLOAD);
+
        return TRUE;
 }