develooper Front page | perl.cvs.parrot | Postings from November 2008

[svn:parrot] r33358 - trunk/src

From:
chromatic
Date:
November 29, 2008 17:53
Subject:
[svn:parrot] r33358 - trunk/src
Message ID:
20081130015256.DD40CCB9AF@x12.develooper.com
Author: chromatic
Date: Sat Nov 29 17:52:56 2008
New Revision: 33358

Modified:
   trunk/src/inter_create.c

Log:
[src] Fixed a memory leak where the memory allocated for dynop libraries never
had a corresponding free.  Now it gets freed only in the parentmost interpreter
during global destruction.

Modified: trunk/src/inter_create.c
==============================================================================
--- trunk/src/inter_create.c	(original)
+++ trunk/src/inter_create.c	Sat Nov 29 17:52:56 2008
@@ -396,9 +396,9 @@
         Parrot_STM_destroy(interp);
     }
 
-    if (interp->parent_interpreter &&
-        interp->thread_data &&
-        (interp->thread_data->state & THREAD_STATE_JOINED)) {
+    if (interp->parent_interpreter
+    &&  interp->thread_data
+    && (interp->thread_data->state & THREAD_STATE_JOINED)) {
         Parrot_merge_header_pools(interp->parent_interpreter, interp);
         Parrot_merge_memory_pools(interp->parent_interpreter, interp);
     }
@@ -460,29 +460,34 @@
         parrot_free_vtables(interp);
         Parrot_mmd_destroy(interp);
 
+        /* dynop libs */
+        if (interp->n_libs > 0)
+            mem_sys_free(interp->op_info_table);
+
         MUTEX_DESTROY(interpreter_array_mutex);
         mem_sys_free(interp);
-        /*
-         * finally free other globals
-         */
+
+        /* finally free other globals */
         mem_sys_free(interpreter_array);
         interpreter_array = NULL;
     }
 
     else {
         /* don't free a thread interpreter, if it isn't joined yet */
-        if (!interp->thread_data || (
-                    interp->thread_data &&
-                    (interp->thread_data->state & THREAD_STATE_JOINED))) {
+        if (!interp->thread_data
+        || (interp->thread_data
+        && (interp->thread_data->state & THREAD_STATE_JOINED))) {
             if (interp->thread_data) {
                 mem_sys_free(interp->thread_data);
                 interp->thread_data = NULL;
             }
+
             mem_sys_free(interp);
         }
     }
 }
 
+
 /*
 
 =back



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About