Thread-safe Exceptions are leaking

Andreas Wolf ahw@mps.OHIO-STATE.EDU
Sun Oct 4 08:32:00 GMT 1998


Hi,
	I was waiting a long time for C++ exception handling to
	become thread-safe... We need this for our applications!

	Unfortunately, our programs are supposed to run for
	months at a time which makes memory leaks intolerable.
	(what a pain with C++ ;-) But switching on optimization
	when compiling code with exceptions, egcs creates leaks!!

	I traced the problem down to the DEFER_POP optimization
	step, that eliminates catch/cleanup code. Now we only have
	to teach egcs not to touch this part of the code.
	Here is a patch to gcc/cp/except.c that seems to do that,
	setting an attribute in the tree leaf of the 'CatchMatch'
	function.

gcc/cp/except.c
223a224,226
>   /*ahw: Try to switch on NO_DEFER_POP to close memory leak*/
>   TREE_READONLY (CatchMatch) = 1;
> 

	Can some expert 'validate' this patch or find a better
	one? If you need to test it, I can give you some
	pseudo code / code snipplets that demonstrate the leak.
	Please, email me directly, since I'm not reading this list
	regularly.

	Thanks a bunch!!
		Andreas =:-)

-- 
----------------------------------------------------------------------
** Andreas H. Wolf       	******      *******	*      *
** The Ohio State University   *      *    *		*      *
** Smith Lab		       *      *    *            *      *
** 174 West, 18th Ave          *      *     ******      *      *
** Columbus, OH 43210-1106     *      *           *	*      *
** Phn: (614) 292-6799         *      *           *     *      * Go Bucks!
** FAX: (614) 292-8261          ******     *******	 ******
** E-Mail: ahw@mps.ohio-state.edu
** WWW: http://www.physics.ohio-state.edu/~ahw/
**
** 'Help Gromit! The techno trousers are going haywire!!' - Wallace
----------------------------------------------------------------------



More information about the Gcc-patches mailing list