- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - Linux
- >
- Purify reports std::vector memory leak
Operating System - Linux
1820594
Members
1367
Online
109626
Solutions
Forums
Categories
Company
Local Language
юдл
back
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Discussions
Forums
Forums
Discussions
юдл
back
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Blogs
Information
Community
Resources
Community Language
Language
Forums
Blogs
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-02-2008 12:29 AM
тАО05-02-2008 12:29 AM
Purify reports std::vector memory leak
Hi,
I've encountered problems with std::vector on HPUX. Purify reports memory leaks:
MLK: 1536 bytes leaked in 2 blocks
This memory was allocated from:
malloc [rtlib.o]
operator new(unsigned long) [libCsup_v2.2]
operator new(unsigned long) [rtlib.o]
std::vector>::_C_insert_aux(stoppert *,const stoppert &) [vector.cc:157]
std::vector>::push_back(const stoppert &) [vector:566]
Stopper::start() [Stopper.cpp:72]
static Connection::ClntMsgTh(void *) [Connection.cpp:8864]
__pthread_body [libpthread.1_pure_p3_c0_101232010_B1111_64_178192.a2s.HPUX.24291.tmp]
__pthread_start [libpthread.1_pure_p3_c0_101232010_B1111_64_178192.a2s.HPUX.24291.tmp]
Block of 768 bytes (2 times); last block at 0x80000001006b7e68
here is Stopper::start() function:
int Stopper::start()
{
stoppert start;
ftime( &start.time );
start.index = nextIndex++;
times.push_back(start);
return start.index;
}
times is a std:vector member of Stopper class.
Method start() is called from Connection::ClntMsgTh on a local variable:
Stopper mtx_time;
mtx_time.start();
Beside this one, purify reports leaks in many other calls of Stopper::start().
I'm using aCC: HP ANSI C++ B3910B A.03.70
Can anyone help me explaining this leaks?
I've encountered problems with std::vector on HPUX. Purify reports memory leaks:
MLK: 1536 bytes leaked in 2 blocks
This memory was allocated from:
malloc [rtlib.o]
operator new(unsigned long) [libCsup_v2.2]
operator new(unsigned long) [rtlib.o]
std::vector
std::vector
Stopper::start() [Stopper.cpp:72]
static Connection::ClntMsgTh(void *) [Connection.cpp:8864]
__pthread_body [libpthread.1_pure_p3_c0_101232010_B1111_64_178192.a2s.HPUX.24291.tmp]
__pthread_start [libpthread.1_pure_p3_c0_101232010_B1111_64_178192.a2s.HPUX.24291.tmp]
Block of 768 bytes (2 times); last block at 0x80000001006b7e68
here is Stopper::start() function:
int Stopper::start()
{
stoppert start;
ftime( &start.time );
start.index = nextIndex++;
times.push_back(start);
return start.index;
}
times is a std:vector member of Stopper class.
Method start() is called from Connection::ClntMsgTh on a local variable:
Stopper mtx_time;
mtx_time.start();
Beside this one, purify reports leaks in many other calls of Stopper::start().
I'm using aCC: HP ANSI C++ B3910B A.03.70
Can anyone help me explaining this leaks?
3 REPLIES 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-02-2008 01:45 AM
тАО05-02-2008 01:45 AM
Re: Purify reports std::vector memory leak
>I'm using aCC: HP ANSI C++ B3910B A.03.70
I don't remember when I fixed the last bug in vector. For 11.11, you can patch up to A.03.77, PHSS_36087:
http://h21007.www2.hp.com/portal/site/dspp/template.PAGE/page.document/?ciid=2645dec4c7563110VgnVCM100000275d6e10RCRD#b11.11pa
>Can anyone help me explaining this leaks?
From your source, when you call push_back, you have to make a copy of "start" to add it to the vector. (If you are very unlucky, and the vector is full, every element must be copied but that shouldn't have leaks.)
Do you know the size of a stoppert? Is it 1536/2? If not, that size could be due to the vector reallocation. What's on vector.cc:157?
Where are you destroying Stopper::times?
I don't remember when I fixed the last bug in vector. For 11.11, you can patch up to A.03.77, PHSS_36087:
http://h21007.www2.hp.com/portal/site/dspp/template.PAGE/page.document/?ciid=2645dec4c7563110VgnVCM100000275d6e10RCRD#b11.11pa
>Can anyone help me explaining this leaks?
From your source, when you call push_back, you have to make a copy of "start" to add it to the vector. (If you are very unlucky, and the vector is full, every element must be copied but that shouldn't have leaks.)
Do you know the size of a stoppert? Is it 1536/2? If not, that size could be due to the vector reallocation. What's on vector.cc:157?
Where are you destroying Stopper::times?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-02-2008 07:41 AM
тАО05-02-2008 07:41 AM
Re: Purify reports std::vector memory leak
>you can patch up to A.03.77, PHSS_36087:
I will try this, but it will take some time, because I am not the system administrator...
>Where are you destroying Stopper::times?
Stopper::times should be destroyed when the Stopper object exits the scop, i.e. when Connection::ClntMsgTh returns. I don't know if this is important, but this function is called every time from a different thread.
> Do you know the size of a stoppert?
Size of stoppert is 24.
>What's on vector.cc:157?
I would love to know this. In /opt/aCC/include_std/vector.cc:157 I found:
_C_end_of_storage = __start + __new_capacity;
I think I'm looking in the wrong file.
I will try this, but it will take some time, because I am not the system administrator...
>Where are you destroying Stopper::times?
Stopper::times should be destroyed when the Stopper object exits the scop, i.e. when Connection::ClntMsgTh returns. I don't know if this is important, but this function is called every time from a different thread.
> Do you know the size of a stoppert?
Size of stoppert is 24.
>What's on vector.cc:157?
I would love to know this. In /opt/aCC/include_std/vector.cc:157 I found:
_C_end_of_storage = __start + __new_capacity;
I think I'm looking in the wrong file.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-02-2008 04:49 PM
тАО05-02-2008 04:49 PM
Re: Purify reports std::vector memory leak
>I will try this, but it will take some time, because I am not the system administrator.
All you need is the two vector include files.
>Stopper::times should be destroyed when the Stopper object exits the scope
I assume it leaks after there? If before, it's a different issue.
>Size of stoppert is 24.
Then it looks like the whole vector is messed up?
>I would love to know this. In /opt/aCC/include_std/vector.cc:157 I found:
_C_end_of_storage = __start + __new_capacity;
I think I'm looking in the wrong file.
The last 3 versions have this same line but there could be 2 fixes missing.
JAGaf50801: vector::insert doesn't set last. Problem is with caller to copy_backward, not itself.
JAGad78735: can't change _C_end_of_storage if not reallocated.
JAGad87227: Fix for allocation of uninitialized storage
All you need is the two vector include files.
>Stopper::times should be destroyed when the Stopper object exits the scope
I assume it leaks after there? If before, it's a different issue.
>Size of stoppert is 24.
Then it looks like the whole vector is messed up?
>I would love to know this. In /opt/aCC/include_std/vector.cc:157 I found:
_C_end_of_storage = __start + __new_capacity;
I think I'm looking in the wrong file.
The last 3 versions have this same line but there could be 2 fixes missing.
JAGaf50801: vector
JAGad78735: can't change _C_end_of_storage if not reallocated.
JAGad87227: Fix for allocation of uninitialized storage
The opinions expressed above are the personal opinions of the authors, not of Hewlett Packard Enterprise. By using this site, you accept the Terms of Use and Rules of Participation.
Company
Learn About
News and Events
Support
© Copyright 2025 Hewlett Packard Enterprise Development LP