This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [patch-rfc] N2179: Exception Propagation in C++


Paolo Carlini wrote:
Paolo Carlini wrote:
Please help with the issue.
Apparently something is wrong with __cxa_free_dependent_exception: is not called anywhere.

Paolo.
Yes, I discovered this too, to my great embarrassment. Attached patch solves the leak (verified with valgrind). I'm currently running the testsuite with it. It's not finished, but it's past the exception_ptr tests; no failures.

Sebastian
Index: libstdc++-v3/libsupc++/eh_ptr.cc
===================================================================
--- libstdc++-v3/libsupc++/eh_ptr.cc	(revision 139372)
+++ libstdc++-v3/libsupc++/eh_ptr.cc	(working copy)
@@ -192,6 +192,9 @@
   __cxa_exception *header =
     __get_exception_header_from_obj (dep->primaryException);
 
+  // The dependent is always freed.
+  __cxa_free_dependent_exception (dep);
+
   // We only want to be called through _Unwind_DeleteException.
   // _Unwind_DeleteException in the HP-UX IA64 libunwind library
   // returns _URC_NO_REASON and not _URC_FOREIGN_EXCEPTION_CAUGHT
	* libsupc++/eh_ptr.cc (__gxx_dependent_exception_cleanup): Fix a
	memory leak.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]