[jit] Keep unwind info in the domain's memory pool. (#4825)
authorvkargov <kargov@gmail.com>
Thu, 11 May 2017 16:33:41 +0000 (09:33 -0700)
committerLudovic Henry <ludovic@xamarin.com>
Thu, 11 May 2017 16:33:41 +0000 (12:33 -0400)
mono/mini/mini-runtime.c

index 55275e0cade3f739c4a800bc1bda10f6e571f48a..a9d42e691d684612ba388364b7790b6a96967e5b 100644 (file)
@@ -496,6 +496,13 @@ mono_tramp_info_register_internal (MonoTrampInfo *info, MonoDomain *domain, gboo
        if (info->unwind_ops) {
                copy->uw_info = mono_unwind_ops_encode (info->unwind_ops, &copy->uw_info_len);
                copy->owns_uw_info = TRUE;
+               if (domain) {
+                       /* Move unwind info into the domain's memory pool so that it is removed once the domain is released. */
+                       guint8 *temp = copy->uw_info;
+                       copy->uw_info = mono_domain_alloc (domain, copy->uw_info_len);
+                       memcpy (copy->uw_info, temp, copy->uw_info_len);
+                       g_free (temp);
+               }
        } else {
                /* Trampolines from aot have the unwind ops already encoded */
                copy->uw_info = info->uw_info;