This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ 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: Recent strstream regression: reversion needed?


Paolo Carlini wrote:

In the next hours I hope to make progress in understanding /why/!
I bit of additional information: with the _M_buf = buf change the segmentation fault happens during the output, after the first reallocation, in basic_streambuf<_CharT, _Traits>::sputc(char_type __c). It looks like there is something wrong in fiddling with _M_buf after the initial allocation.

Benjamin, could you possibly check with 'valgrind' that the memory leak reported in libstdc++/6594 does /really/ happen with the old code? Really, that is not at all obvious to me given the _M_free(eback()) call in the original ~strstreambuf().

Perhaps I should add some information supporting this, therefore let us consider the testcase printing the integers 0-999 and the old code (before libstdc++/6594 commit).

- The value of buf at the end of each overflow call:
overflow::buf = 0x8049980
overflow::buf = 0x80499a8
overflow::buf = 0x80499f0
overflow::buf = 0x8049a78
overflow::buf = 0x8049b80
overflow::buf = 0x8049d88
overflow::buf = 0x804a190
overflow::buf = 0x804a998

- The value of this->eback() in ~strstreambuf():
this->eback() = 0x804a998

The fact that the last value of overflow::buf is identical to this->eback() seems to me sort of a proof that there are no memory leaks.

What do you think?

Ciao, Paolo.




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