[prev in list] [next in list] [prev in thread] [next in thread] 

List:       ms-atl
Subject:    Re: BoundsChecker report error in STL
From:       "Wyss, Felix" <FelixW () ININ ! COM>
Date:       2000-07-30 6:12:58
[Download RAW message or body]


STLport uses an efficent sub-allocation strategy for objects that are less
than or equal to 128 bytes.  As this memory is never returned to the heap,
BoundsChecker will report tons of leaks as it cannot know that the memory is
actually not leaked but re-used by STLport.

Felix

-----Original Message-----
From: Kevin Burton [mailto:kevin.burton@AVSTARNEWS.COM]
Sent: Thursday, July 27, 2000 16:54
To: ATL@DISCUSS.MICROSOFT.COM
Subject: Re: BoundsChecker report error in STL


I have tried BoundsChecker 6.5 with the following code (below). With 6.5 I
no longer get the errors with strings but vectors seem to give dangling
pointer problems with destruction. There is no mention of a memory leak.
There is a resource leak by InitializeCriticalSection in osfinfo.c (409)

When I try the same program with STLport-4.0 I get

        Memory leak 320 bytes allocated by _malloc_dbg in
stlport\stl\_alloc.c (221), Handle: 0x011A10A0

The "Results" window shows that this leak occured 2 times for a total loss
of 1304 bytes. Same resource leak.

If I try STLport-4.0  with SGI I/O Streams (compile the libraries). Then I
get

        Memory leak 320 bytes allocated by _malloc_dbg in
stlport\stl\_alloc.c (221), Handle: 0x012C2410
        Memory leak 20 bytes allocated by operator new in
.\locale_catalog.cpp (124), Handle: 0x012C60D0
        Memory leak 772 bytes allocated by operator new in stlport\new
(109), Handle: 0x012C6118
        Resource leak: allocated by InitializeCriticalSection in osfinfo.c
(409), Handle: 0x012C1F88

Kevin Burton
Kevin.Burton@avstarnews.com

// TestSTL.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include <iostream>
#include <string>
#include <vector>

int main(int argc, char* argv[])
{
        std::vector< std::string > vec;
        std::string str1;
        std::string str2;

        std::cout << _T("Hello World!\n");
        str1 = _T("Hello! Hello!\n");
        std::cout << str1;
        vec.push_back(str1);

        str2 = _T("Goodbye World!\n");
        std::cout << str2;
        vec.push_back(str2);

        return 0;
}

-----Original Message-----
From: Gentile, Sam [mailto:sam.gentile@COMPUWARE.COM]
Sent: Thursday, July 27, 2000 2:24 PM
To: ATL@DISCUSS.MICROSOFT.COM
Subject: Re: [ATL] BoundsChecker report error in STL


There are versions of the STL that do contain dangling pointers in the
delete/erase code.  BoundsChecker is correct in pointing them out.

I'm not sure what version this customer is using so I can't comment
directly.

By the way, this customer is running a fairly old version of BoundsChecker
(e.g. 6.03).  We've made a number of enhancements to the FinalCheck
technology in the BoundsChecker 6.2 and 6.5 releases.

Sam Gentile
Principal Software Engineer
Compuware NuMega
Performance & Coverage Group
sam.gentile@numega.com
www.numega.com
http://www.c2.com/cgi/wiki?SamGentile
"Love Yourself. Love Your Neighbor. Love Your COM"


-----Original Message-----
From: Yufei Zhang [mailto:yufei.zhang@FACTIVA.COM]
Sent: Thursday, July 27, 2000 11:51 AM
To: ATL@DISCUSS.MICROSOFT.COM
Subject: BoundsChecker report error in STL


Hi, everyone,

I use STL in my code and when I use boundschecker to debug my code, it
reports several error in STL:

Windows NT 4.0 SP4.0
Visual C++ 6.0
BoundsChecker 6.03(build 1060)

following is the code fragment and error reported by boundschecker:

code:
std::string strData;
std::string temp(strData);
strData.erase();
error:
Experession uses dangling pointer: PTR: 0x2216DF8
Array index out of range: PTR: 0x02461581

code:
std::cout << "sssss";
error:
Resource leak: allocated by InitializeCriticalSection inosfinfo.c(409),
HANDLE: 0x02236138(when I delete the above code, no such error)

Does anyone meet the same error and know how to fix it?

Thanks
Yufei

----------------------------------------------------------------
Users Guide http://msdn.microsoft.com/workshop/essentials/mail.asp
contains important info including how to unsubscribe.  Save time, search
the archives at http://discuss.microsoft.com/archives/index.html

----------------------------------------------------------------
Users Guide http://msdn.microsoft.com/workshop/essentials/mail.asp
contains important info including how to unsubscribe.  Save time, search
the archives at http://discuss.microsoft.com/archives/index.html

----------------------------------------------------------------
Users Guide http://msdn.microsoft.com/workshop/essentials/mail.asp
contains important info including how to unsubscribe.  Save time, search
the archives at http://discuss.microsoft.com/archives/index.html

----------------------------------------------------------------
Users Guide http://msdn.microsoft.com/workshop/essentials/mail.asp
contains important info including how to unsubscribe.  Save time, search
the archives at http://discuss.microsoft.com/archives/index.html

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic