Solved

Memory Leak :(

Posted on 2001-08-16
8
275 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
[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
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
Technology Partners: 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!

 
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

Enroll in May's Course of the Month

May’s Course of the Month is now available! Experts Exchange’s Premium Members and Team Accounts have access to a complimentary course each month as part of their membership—an extra way to increase training and boost professional development.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Quicksort a dynamic deque 33 84
Header of docx file 17 145
How to measure current at integrated circuit (IC) power pin using Current Probe ? 6 78
COM server issue 2 30
Written by John Humphreys C++ Threading and the POSIX Library This article will cover the basic information that you need to know in order to make use of the POSIX threading library available for C and C++ on UNIX and most Linux systems.   [s…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
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.

710 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