Solved

Numega  and memory leak

Posted on 2002-04-10
8
464 Views
Last Modified: 2013-12-14
Hello,
I'm using Numega(bound checker) with VC++ 6.0.
I'm writing a basic program : historical "foo()" function
that doing nothing, and I see 4 memory leaks:

   memory leak-Operator _new in locale0.cpp (55) : 40 bytes
   memory leak-Operator _new in .\xmemory (30): 33 bytes
   memory leak-_Malloc_dbg in onexit.c(251): 176 bytes
   Resource Leak:Initialize criticalSection in xlock.cpp(50)
 Expert,Can you help me to understand this phenomena?
 Thanks by advance.
NathalieB.

 
 
0
Comment
Question by:NathalieB
  • 4
  • 3
8 Comments
 
LVL 10

Expert Comment

by:makerp
ID: 6930990
lets see yoru sauce code
0
 

Author Comment

by:NathalieB
ID: 6931028
#pragma warning(disable:4786)
#include <map>
using namespace std;

class CMapTest
{
public:
     typedef map<long,int> TTransMap;

     CMapTest();
     
     ~CMapTest();
     
     void InsertLong(const long lvalue,int lResult );
private:

     TTransMap m_mapTransceiver;
     
};


CMapTest::CMapTest()
{}


CMapTest::~CMapTest()
{
     m_mapTransceiver.clear();
}


void CMapTest::InsertLong(const long lvalue,int lResult )
{
     pair<TTransMap::iterator,bool> a = m_mapTransceiver.insert(make_pair(lvalue,lResult));
}

void main()
{

     CMapTest toto;
     toto.InsertLong(3,1);
}
0
 
LVL 10

Accepted Solution

by:
makerp earned 50 total points
ID: 6931044
you have nothing allocated outside of main so it aint that. it looks to me like these are allocations in the STL, therefore i would not worry. you will have to hack your implementation of the stl to fix them, something i would not suggest
0
 

Author Comment

by:NathalieB
ID: 6931152
Hello,
I'm using STlport4.0 ang a big consumer of these containers.
So Do you know which files it's concerned and if existing an updating version that solve the problems?
 
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 10

Expert Comment

by:makerp
ID: 6931157
does the number of leaks increase with the more code you create or does it stay constant, if it stays constant then ignore it
0
 
LVL 1

Expert Comment

by:Mensana
ID: 6931465

Hi Nathalie,

I ran your code in VC++ 6.0, in debug mode and there were no memory leaks reported. Not that I want to praise what big MS does, but from my painful experiences with Numega's BoundsChecker, I'd rather rely on what Microsoft reports this time.
In fact your code is so simple that you don't need BoundsChecker to see whether memory leaks exist or not.
To convince yourself, replace one of the map's types with a more complex type that has a destructor and than trace inside it. You'll notice that the destructor is called when you call map::clear.

Regards,
Eddie
0
 
LVL 10

Expert Comment

by:makerp
ID: 6931484
i use

#include <crtdbg.h>

void main()
{
  _CrtSetReportMode(_CRT_WARN,_CRTDBG_MODE_FILE);
  _CrtSetReportFile(_CRT_WARN,_CRTDBG_FILE_STDOUT);

  /* blah blah */

  _CrtDumpMemoryLeaks();
}
0
 

Author Comment

by:NathalieB
ID: 6934103
Hello makerp,

I receive the respons from Numega Support:
http://nashua.compuware.com/support/knowledgebase/docs/344.htm
Thank you.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Embarcadero C++ Builder XE2 TDateTime 8 61
How to copy an image file into clipboard C/C++? 1 153
Exception thrown at 0x00007FFD5BC81F28 7 38
c++, dynamic object by json 1 25
When writing generic code, using template meta-programming techniques, it is sometimes useful to know if a type is convertible to another type. A good example of when this might be is if you are writing diagnostic instrumentation for code to generat…
How to install Selenium IDE and loops for quick automated testing. Get Selenium IDE from http://seleniumhq.org Go to that link and select download selenium in the right hand columnThat will then direct you to their download page.From that page s…
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

867 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now