Solved

Function call at the end of an application

Posted on 2011-02-14
6
1,055 Views
Last Modified: 2013-11-20
Hiya

Is there a way for me to determine which functions/messages are called at the end of an application? That is, I have a memory leak which I'm trying to find and I want to see where the problem is.

John
0
Comment
Question by:IssacJones
[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
6 Comments
 
LVL 4

Accepted Solution

by:
incerc earned 84 total points
ID: 34891359
Hi,

You can try to run the program into debugging mode, using the tools that Visual Studio provides for memory leaks detection.

Pls read http://msdn.microsoft.com/en-us/library/x98tx3cf%28v=vs.80%29.aspx and http://msdn.microsoft.com/en-us/library/c99kz476%28v=vs.80%29.aspx (for MFC).

The object dumps & dumps statistics are pretty effective.
0
 
LVL 44

Expert Comment

by:AndyAinscow
ID: 34894399
>>Is there a way for me to determine which functions/messages are called at the end of an application?

The memory leak might be caused by a line of code right at the application start assigning memory which isn't then released.   Don't make ANY assumptions about where it might be.
0
 
LVL 34

Assisted Solution

by:sarabande
sarabande earned 83 total points
ID: 34895178
for an SDI or MDI mfc application the program runs nearly all time in CWinThread::Run where the message loop was performed. you could provide an overload of CWinApp::ExitInstance in your application class which would be called as very last function by the mfc framework.

for a dialog-based mfc application the program exits in InitInstance function of your application class after DoModal call.

Sara
0
Industry Leaders: 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:IssacJones
ID: 34895341
Hi Andy

I understand what you mean about memory that isn't released. If this is the case how can I find the problem line?

John
0
 
LVL 44

Assisted Solution

by:AndyAinscow
AndyAinscow earned 83 total points
ID: 34895370
I'd look at the links provided by incerc, they seem to be relevant.

Look at the output window, it should say what type of object was assigned but not being freed and more info about it.
0010.jpg
0
 

Author Closing Comment

by:IssacJones
ID: 34895400
Thank you all
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

Introduction: Dynamic window placements and drawing on a form, simple usage of windows registry as a storage place for information. Continuing from the first article about sudoku.  There we have designed the application and put a lot of user int…
Introduction: Displaying information on the statusbar.   Continuing from the third article about sudoku.   Open the project in visual studio. Status bar – let’s display the timestamp there.  We need to get the timestamp from the document s…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

740 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