Solved

Memory Leak :(

Posted on 2001-08-16
8
273 Views
Last Modified: 2011-09-20
If there are any guru's out there.....I can sure use a hand right about now.  I have a C++ app that interfaces with a VB app.  I use the C++ app to send remote commands to my VB app.  The VB app in turn replies with a response to the C++ app.  As far as I can tell at this point....if I send consecutive commmands remotely to the VB app....I receive virtual memory errors.  I have a process (that I view with task manager) that begins to grow in size exponentially until the virtual memory error occurs.  I realize this may be somewhat vague....but if anyone has any suggestions...it would sure be helpful.  


thanks,


saki
0
Comment
Question by:sakibomber
8 Comments
 

Expert Comment

by:tsukko
ID: 6395012
Obviously you have some memory that you are not dealocating.  It probalby isn't a probablem in your vb program, that handles memory collection on it's own I believe, so you must have some dynamic variables in your c++ program that you are not deleting.  showing us some code would probably help.
0
 
LVL 3

Expert Comment

by:cwrea
ID: 6395271
Assuming you are using Visual C++, recompile a debug version of your program with the symbol _CRTDBG_MAP_ALLOC defined.  This will cause your program to use the debugging heap, which will tell you of any memory that was not deallocated when your program exits (including the location where it was allocated, and the size of the block).  You can also specifically make a call to _CrtDumpMemoryLeaks() at any point.

There are a number of other useful functions in the _CrtDebug* family.  They are all documented in MSDN.

Also - a number of tools exist to isolate these kinds of problems.  They include BoundsChecker and Purify.  They also find many other kinds of resource leaks and API problems.

I've found a combination of the above techniques effective.


0
 
LVL 2

Expert Comment

by:VCStud
ID: 6395779
Could you give some code over here. That would help to find the problem better
0
Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

 
LVL 14

Expert Comment

by:DragonSlayer
ID: 6404784
perhaps you are using some strings that you allocated but did not free?
0
 
LVL 49

Expert Comment

by:DanRollins
ID: 6405311
>>I use the C++ app to send remote commands to my VB app.  The VB app in turn replies with a response to the C++ app.  

Please describe the mechanism that you are using to communicate.  Are you using SendMessage?  PostMessage?  DDE?  Do you have an ActiveX object?  Is this an old-style "shared DLL" technique?

And please supply some code showing this mechanism.

-- Dan
0
 

Author Comment

by:sakibomber
ID: 6411893
Sorry everyone for the long delay.  Ive been knee deep in code.  From what I can tell....There is something funky happening with my SingleLock API.  I have multiple threads and somehow items are becoming 'deadlocked' within the code.  Im not sure if they are being Locked more than once, and then released...so when the other API call attempts to release it...its already gone.  Hmm..


I really have no idea at this point.  I would display the code...but I dont think I can fit all 50000 lines in here. :)


saki
0
 
LVL 49

Accepted Solution

by:
DanRollins earned 200 total points
ID: 6414494
I think that 40,000 lines or so should be more than enough.

But here's another idea.  Why not spend a moment and describe the problem?  This is not PE (Psychics-Exchange) where we can read your mind across vast distances.

-- Dan
0
 

Author Comment

by:sakibomber
ID: 6441440
Ha ha ha......Sorry, I know you guys arent mind readers.  This was a very difficult question to ask because I wasnt sure where the source of the problem was.  I managed to isolate the problem and I think there is a solution in the works.


thanks everyone.



saki
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

IntroductionThis article is the second in a three part article series on the Visual Studio 2008 Debugger.  It provides tips in setting and using breakpoints. If not familiar with this debugger, you can find a basic introduction in the EE article loc…
C++ Properties One feature missing from standard C++ that you will find in many other Object Oriented Programming languages is something called a Property (http://www.experts-exchange.com/Programming/Languages/CPP/A_3912-Object-Properties-in-C.ht…
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

856 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