Author: chromatic
Date: Wed Mar 28 22:54:42 2007
New Revision: 17827
Modified:
trunk/include/parrot/exceptions.h
trunk/src/exceptions.c
trunk/src/inter_create.c
Log:
Really free exception data structures at interpreter exit.
Modified: trunk/include/parrot/exceptions.h
==============================================================================
--- trunk/include/parrot/exceptions.h (original)
+++ trunk/include/parrot/exceptions.h Wed Mar 28 22:54:42 2007
@@ -193,6 +193,10 @@
PARROT_API void Parrot_pop_mark(Interp *, INTVAL mark);
PARROT_API void Parrot_push_action(Interp *, PMC *sub);
+/* global cleanup */
+void Parrot_destroy_exception_list(Interp *interp);
+void Parrot_really_destroy_exception_list(Parrot_exception *e);
+
#endif /* PARROT_EXCEPTIONS_H_GUARD */
/*
Modified: trunk/src/exceptions.c
==============================================================================
--- trunk/src/exceptions.c (original)
+++ trunk/src/exceptions.c Wed Mar 28 22:54:42 2007
@@ -612,6 +612,26 @@
interp->exc_free_list = e;
}
+void
+destroy_exception_list(Interp *interp)
+{
+ really_destroy_exception_list(interp->exceptions);
+ really_destroy_exception_list(interp->exc_free_list);
+}
+
+void
+really_destroy_exception_list(Parrot_exception *e)
+{
+ Parrot_exception *prev;
+
+ while (e != NULL)
+ {
+ prev = e->prev;
+ mem_sys_free(e);
+ e = prev;
+ }
+}
+
/*
=item C<void
Modified: trunk/src/inter_create.c
==============================================================================
--- trunk/src/inter_create.c (original)
+++ trunk/src/inter_create.c Wed Mar 28 22:54:42 2007
@@ -425,6 +425,7 @@
/* predefined exceptions */
mem_sys_free(interp->exception_list);
+ destroy_exception_list(interp);
if (interp->evc_func_table)
mem_sys_free(interp->evc_func_table);
/* strings, charsets, encodings - only once */