[ https://issues.apache.org/jira/browse/STDCXX-579?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12532752
]
Travis Vitek commented on STDCXX-579:
-------------------------------------
I accessed the rdbuf() directly for consistency. Now that I've looked at it a bit further,
I think I should avoid the freeze call altogether by streaming out.rdbuf() instead of out.rdbuf()->str()
or out.str(). I'll submit another patch that solves the issue that way.
> purify reports memory leaked by strstreambuf example
> ----------------------------------------------------
>
> Key: STDCXX-579
> URL: https://issues.apache.org/jira/browse/STDCXX-579
> Project: C++ Standard Library
> Issue Type: Improvement
> Components: Examples
> Reporter: Travis Vitek
> Assignee: Travis Vitek
> Priority: Minor
> Fix For: 4.2.1
>
> Attachments: stdcxx-579.patch
>
>
> The example calls out.rdbuf()->str() which calls freeze(). If the buffer if frozen,
the destructir is not allowed to free the memory [D.7.1.2 p8].
> **** Purify instrumented ./strstreambuf (pid 27069) ****
> Purify: Searching for all memory leaks...
> Memory leaked: 200 bytes (100%); potentially leaked: 0 bytes (0%)
> MLK: 200 bytes leaked at 0x80c01d8
> * This memory was allocated from:
> malloc [rtlib.o]
> operator new(unsigned) [libstd15d.so]
> operator new [](unsigned) [libstd15d.so]
> std::strstreambuf::setbuf(char*, int) [strstream.cpp:292]
> std::basic_streambuf<char, std::char_traits<char> >::pubsetbuf(char*, int)
[streambuf:91]
> main [strstreambuf.cpp:78]
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
|