> -----Original Message----- > From: Martin Sebor [mailto:[EMAIL PROTECTED] > Sent: Sunday, July 16, 2006 11:46 PM > To: [email protected] > Subject: Re: design of testuite exceptions (was: Re: svn > commit: r418319 - > /incubator/stdcxx/trunk/tests/strings/21.string.io.cpp) > > PS One thing to look into is formatting the text of the > exception's what string directly into the what_ buffer > instead dynamically allocating it only to free it later.
> I believe rw_asnprintf has the ability to use the provided > buffer if it's large enough. Unfortunately, rw_asnprintf cannot use buffer with automatic or static storage. rw_asnprintf calls rw_vasnprintf which calls _rw_bufcat. If the buffer size is too small the _rw_bufcat allocates the memory using malloc() and unconditionally calls free() for the old buffer. Moreover the _rw_bufcat allocates the memory including the guard block (printf.cpp line 425) and even if the initial buffer was allocated using malloc() RW_ASSERT (printf.cpp line 461) will terminate the execution in the debug configurations. Farid.
