You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@stdcxx.apache.org by "Travis Vitek (JIRA)" <ji...@apache.org> on 2007/10/05 01:19:50 UTC

[jira] Created: (STDCXX-579) purify reports memory leaked by strstreambuf example

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: Bug
          Components: Examples
            Reporter: Travis Vitek
            Assignee: Travis Vitek
            Priority: Minor
             Fix For: 4.2.1


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.


[jira] Updated: (STDCXX-579) purify reports memory leaked by strstreambuf example

Posted by "Travis Vitek (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/STDCXX-579?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Travis Vitek updated STDCXX-579:
--------------------------------

    Attachment: stdcxx-579.patch

2007-10-04  Travis Vitek  <vi...@roguewave.com>

	STDCXX-579
	* strstreambuf.cpp (main): Unfreeze streambuf so destructor
	will deallocate memory.

> 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: Bug
>          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.


[jira] Resolved: (STDCXX-579) purify reports memory leaked by strstreambuf example

Posted by "Farid Zaripov (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/STDCXX-579?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Farid Zaripov resolved STDCXX-579.
----------------------------------

    Resolution: Fixed

> 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
>    Affects Versions: 4.2.0
>            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.


[jira] Updated: (STDCXX-579) purify reports memory leaked by strstreambuf example

Posted by "Travis Vitek (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/STDCXX-579?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Travis Vitek updated STDCXX-579:
--------------------------------

    Patch Info: [Patch Available]

> 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: Bug
>          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.


[jira] Commented: (STDCXX-579) purify reports memory leaked by strstreambuf example

Posted by "Martin Sebor (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/STDCXX-579?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12532758 ] 

Martin Sebor commented on STDCXX-579:
-------------------------------------

We should not forget that the purpose of the example is to demo the strstreambuf class, not strstream or other higher-level classes.

> 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.


[jira] Commented: (STDCXX-579) purify reports memory leaked by strstreambuf example

Posted by "Martin Sebor (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/STDCXX-579?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12534097 ] 

Martin Sebor commented on STDCXX-579:
-------------------------------------

The patch looks good to me. Feel free to commit it whenever you're ready.

> 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.


[jira] Commented: (STDCXX-579) purify reports memory leaked by strstreambuf example

Posted by "Farid Zaripov (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/STDCXX-579?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12536775 ] 

Farid Zaripov commented on STDCXX-579:
--------------------------------------

Commited thus: http://svn.apache.org/viewvc?rev=587173&view=rev

> 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.


[jira] Commented: (STDCXX-579) purify reports memory leaked by strstreambuf example

Posted by "Travis Vitek (JIRA)" <ji...@apache.org>.
    [ 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.


[jira] Updated: (STDCXX-579) purify reports memory leaked by strstreambuf example

Posted by "Travis Vitek (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/STDCXX-579?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Travis Vitek updated STDCXX-579:
--------------------------------

      Severity: Incorrect Behavior
    Issue Type: Improvement  (was: Bug)

> 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.


[jira] Closed: (STDCXX-579) purify reports memory leaked by strstreambuf example

Posted by "Farid Zaripov (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/STDCXX-579?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Farid Zaripov closed STDCXX-579.
--------------------------------


> 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
>    Affects Versions: 4.2.0
>            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.


[jira] Commented: (STDCXX-579) purify reports memory leaked by strstreambuf example

Posted by "Farid Zaripov (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/STDCXX-579?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12532656 ] 

Farid Zaripov commented on STDCXX-579:
--------------------------------------

It is not so important, but why "out.rdbuf ()->freeze (false)" and not just "out.freeze (false)"?

I suppose that out.rdbuf () used for consistency with the other using of the out.rdbug() in the example, right?

> 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.