[libstdc++ PATCH] Fix leak in _Rb_tree::_M_insert (stl_tree.h)

Earl Chew earl_chew@agilent.com
Fri Feb 25 23:33:00 GMT 2005


Benjamin Kosnik wrote:
> Maybe you can post what you are doing, exactly? It would be nice to test
> for this in libstdc++ as well as fixing it. 
> 
> Is this just a throwing allocator, outlined by Matt in one of his
> articles? (This looks to be a near-term addition to libstdc++ testsuite,
> regardless of this patch.) 
> 
> Or, something else?

I am porting DW2 EH gcc 3.4.2 to VxWorks. The standard VxWorks port
using sjlj. I was looking for a way to verify that EH in STL is
functioning correctly. After casting around a bit, I could only really
find the EH test harness in STLport. The mechanics are also mentioned
in:

http://www.boost.org/more/generic_exception_safety.html

I downloaded STLport 4.6.2 and fiddled around with test/eh to get
it to compile. Most of the changes are in Prefix.h to specify the
non-STLport environment correctly, and then I build and run main.cpp.

I've also compiled and run this test on MSVC.NET2003. Needless to say,
there are "issues".

Looking at the STLport test/eh code there are throwing allocators,
comparators, etc. Basically, anything that can throw, will throw,
eventually. Additionally there is leak detection, and EH guarantee
tests. Very nice.

The only thing that is missing for my purposes is a test for
the underlying gcc EH thread safety mechanisms (ie mutexes protecting
the EH unwinder, etc). Fundamentally I need to test what happens if
two threads throw at the same time.

The legalese in the STLport README says:

* Copyright (c) 1994
* Hewlett-Packard Company
*
* Copyright (c) 1996-1999
* Silicon Graphics Computer Systems, Inc.
*
* Copyright (c) 1997
* Moscow Center for SPARC Technology
*
* Copyright (c) 1999, 2000, 2001, 2002
* Boris Fomitchev
*
* This material is provided "as is", with absolutely no warranty expressed
* or implied. Any use is at your own risk.
*
* Permission to use or copy this software for any purpose is hereby granted
* without fee, provided the above notices are retained on all copies.
* Permission to modify the code and to distribute modified code is granted,
* provided the above notices are retained, and a notice that the code was
* modified is included with the above copyright notice.

My reading of this is that it's ok to incorporate STLport/eh/test
in libstdc++-v3 provided the legalese is retained, but I'm not a
lawyer.

Earl



More information about the Libstdc++ mailing list