From 2946c2ae15947de43c6db3d5a05b306d6f11dd48 Mon Sep 17 00:00:00 2001 From: Zoltan Varga Date: Fri, 20 Aug 2010 00:45:11 +0200 Subject: [PATCH] Fix some AOT memory leaks. --- mono/mini/aot-runtime.c | 13 +++++++++++-- mono/mini/mini.c | 2 ++ mono/mini/mini.h | 1 + 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/mono/mini/aot-runtime.c b/mono/mini/aot-runtime.c index 28545d49648..017cc083dd0 100644 --- a/mono/mini/aot-runtime.c +++ b/mono/mini/aot-runtime.c @@ -165,6 +165,8 @@ static guint32 n_pagefaults = 0; static gsize aot_code_low_addr = (gssize)-1; static gsize aot_code_high_addr = 0; +static GHashTable *aot_jit_icall_hash; + static void init_plt (MonoAotModule *info); @@ -1292,6 +1294,15 @@ mono_aot_init (void) use_aot_cache = TRUE; } +void +mono_aot_cleanup (void) +{ + if (aot_jit_icall_hash) + g_hash_table_destroy (aot_jit_icall_hash); + if (aot_modules) + g_hash_table_destroy (aot_modules); +} + static gboolean decode_cached_class_info (MonoAotModule *module, MonoCachedClassInfo *info, guint8 *buf, guint8 **endbuf) { @@ -3127,8 +3138,6 @@ mono_create_ftnptr_malloc (guint8 *code) #endif } -static GHashTable *aot_jit_icall_hash; - /* * mono_aot_register_jit_icall: * diff --git a/mono/mini/mini.c b/mono/mini/mini.c index 095d8b88da8..fcb2ca1109d 100644 --- a/mono/mini/mini.c +++ b/mono/mini/mini.c @@ -6279,6 +6279,8 @@ mini_cleanup (MonoDomain *domain) mono_llvm_cleanup (); #endif + mono_aot_cleanup (); + mono_trampolines_cleanup (); mono_unwind_cleanup (); diff --git a/mono/mini/mini.h b/mono/mini/mini.h index 9428fdc4d42..01a0b17d23e 100644 --- a/mono/mini/mini.h +++ b/mono/mini/mini.h @@ -1612,6 +1612,7 @@ guint8 *mono_arch_nacl_skip_nops(guint8 *code); /* AOT */ void mono_aot_init (void) MONO_INTERNAL; +void mono_aot_cleanup (void) MONO_INTERNAL; gpointer mono_aot_get_method (MonoDomain *domain, MonoMethod *method) MONO_INTERNAL; gpointer mono_aot_get_method_from_token (MonoDomain *domain, MonoImage *image, guint32 token) MONO_INTERNAL; -- 2.25.1