Avoid leaking the vmmap allocated by the kernel for the thread_act_array_t
[mono.git] / mono / metadata / appdomain.c
index 47d2febbf4a543749a04d7a736acb7b738b055ac..ab1fc103a1a9e67fa4d47ec5fc20c2c001468485 100644 (file)
@@ -73,7 +73,7 @@
  * Changes which are already detected at runtime, like the addition
  * of icalls, do not require an increment.
  */
-#define MONO_CORLIB_VERSION 91
+#define MONO_CORLIB_VERSION 94
 
 typedef struct
 {
@@ -85,12 +85,7 @@ typedef struct
 
 CRITICAL_SECTION mono_delegate_section;
 
-#ifdef _EGLIB_MAJOR
-/* Need to lock here because EGLIB has locking defined as no-ops, we can not depend on mono_strtod do the right locking */
-/* Ideally this will be fixed in eglib */
 CRITICAL_SECTION mono_strtod_mutex;
-#endif
-
 
 static gunichar2 process_guid [36];
 static gboolean process_guid_set = FALSE;
@@ -254,10 +249,7 @@ mono_runtime_init (MonoDomain *domain, MonoThreadStartCB start_cb,
 
        InitializeCriticalSection (&mono_delegate_section);
 
-#ifdef _EGLIB_MAJOR
-       /* Needed until EGLIB is fixed #464316 */
        InitializeCriticalSection (&mono_strtod_mutex);
-#endif
        
        mono_thread_attach (domain);
        mono_context_init (domain);
@@ -998,7 +990,7 @@ add_assemblies_to_domain (MonoDomain *domain, MonoAssembly *ass, GHashTable *ht)
                mono_assembly_addref (ass);
                g_hash_table_insert (ht, ass, ass);
                domain->domain_assemblies = g_slist_prepend (domain->domain_assemblies, ass);
-               mono_trace (G_LOG_LEVEL_INFO, MONO_TRACE_ASSEMBLY, "Assembly %s %p added to domain %s, ref_count=%d\n", ass->aname.name, ass, domain->friendly_name, ass->ref_count);
+               mono_trace (G_LOG_LEVEL_INFO, MONO_TRACE_ASSEMBLY, "Assembly %s[%p] added to domain %s, ref_count=%d", ass->aname.name, ass, domain->friendly_name, ass->ref_count);
        }
 
        if (ass->image->references) {
@@ -2181,7 +2173,6 @@ typedef struct unload_data {
        char *failure_reason;
 } unload_data;
 
-#ifdef HAVE_SGEN_GC
 static void
 deregister_reflection_info_roots_nspace_table (gpointer key, gpointer value, gpointer image)
 {
@@ -2245,7 +2236,6 @@ deregister_reflection_info_roots (MonoDomain *domain)
        mono_domain_assemblies_unlock (domain);
        mono_loader_unlock ();
 }
-#endif
 
 static guint32 WINAPI
 unload_thread_main (void *arg)
@@ -2301,9 +2291,10 @@ unload_thread_main (void *arg)
 #endif
        for (i = 0; i < domain->class_vtable_array->len; ++i)
                clear_cached_vtable (g_ptr_array_index (domain->class_vtable_array, i));
-#ifdef HAVE_SGEN_GC
        deregister_reflection_info_roots (domain);
-#endif
+
+       mono_assembly_cleanup_domain_bindings (domain->domain_id);
+
        mono_domain_unlock (domain);
        mono_loader_unlock ();
 
@@ -2320,7 +2311,7 @@ unload_thread_main (void *arg)
 
        mono_gc_collect (mono_gc_max_generation ());
 
-       mono_thread_detach  (thread);
+       mono_thread_detach (thread);
 
        return 0;
 }