Solved

Memory Leak :(

Posted on 2001-08-16
8
269 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
 
LVL 14

Expert Comment

by:DragonSlayer
ID: 6404784
perhaps you are using some strings that you allocated but did not free?
0
Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

 
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

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

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…
Container Orchestration platforms empower organizations to scale their apps at an exceptional rate. This is the reason numerous innovation-driven companies are moving apps to an appropriated datacenter wide platform that empowers them to scale at a …
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 learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.

744 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

13 Experts available now in Live!

Get 1:1 Help Now