CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2

Thread: Memory Usage

  1. #1
    Join Date
    Jan 2003
    Posts
    1

    Memory Usage

    I have developed two different algorithms(with two different data structures). How can I find the as to which of the two is better in terms of memory usage. In other words, after execution of a certain amount of the algorithm I want to know how much memory is being consumed by the application. How can this be done in VC++.
    =====
    I used the following functions _CrtMemCheckpoint() & _CrtMemDifference( ), & the memory usage difference through the Task Manager. There is great disparity between them, also the task manager shows different values with different runs. Whats the reason for this disparity (No other program was running at that time). Which of the two methods (Task Manager OR Memory debugging fucntions) is more reliable. Also I m a little unsure as to how the statistics produced by these function calls are interpreted.
    Last edited by giggles; March 11th, 2003 at 11:33 PM.

  2. #2
    Join Date
    May 2000
    Location
    Toronto, ON, Canada
    Posts
    3,573
    Hi,

    You have several ways to do that.
    1. Look at Task Manager and see how much memory your app are using
    2. Use Debug Routines functions. Look in MSDN at
    Code:
    void _CrtMemCheckpoint(
       _CrtMemState *state 
    );
    
    int _CrtMemDifference( 
       _CrtMemState *stateDiff,
       const _CrtMemState *oldState,
       const _CrtMemState *newState 
    );
    Regards,

    Emanuel Vaduva

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured