Solved

Memory Leak :(

Posted on 2001-08-16
8
270 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
ScreenConnect 6.0 Free Trial

Explore all the enhancements in one game-changing release, ScreenConnect 6.0, based on partner feedback. New features include a redesigned UI, app configurations and chat acknowledgement to improve customer engagement!

 
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

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

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

Suggested Solutions

What is C++ STL?: STL stands for Standard Template Library and is a part of standard C++ libraries. It contains many useful data structures (containers) and algorithms, which can spare you a lot of the time. Today we will look at the STL Vector. …
This article will show you some of the more useful Standard Template Library (STL) algorithms through the use of working examples.  You will learn about how these algorithms fit into the STL architecture, how they work with STL containers, and why t…
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
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.

770 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