Solved

Numega  and memory leak

Posted on 2002-04-10
8
484 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
FMX TCameraComponent Problem 2 106
Online file editor, manager 6 123
c++, dynamic object by json 1 65
what is the best Integrated development environment 2 65
Introduction This article is a continuation of the C/C++ Visual Studio Express debugger series. Part 1 provided a quick start guide in using the debugger. Part 2 focused on additional topics in breakpoints. As your assignments become a little more …
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
The viewer will learn how to use and create keystrokes in Netbeans IDE 8.0 for Windows.

738 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