SPONSORS:






User Tag List

Results 1 to 4 of 4
  1. #1
    BKD
    BKD is offline
    Junior Member
    Join Date
    Jul 2000
    Posts
    17
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    4test functions to find memory leaks in applications.

    Hi,
    Does any one has 4 test functions to find memory leaks in applications that may be useful for Wondows 2000 or NT OS?

    I ams using silktest 5.5 and this release too has memory leak problem.

    Any help would be a big help.

    Thanks



    ------------------

  2. #2
    Junior Member
    Join Date
    May 2001
    Location
    New Delhi , India
    Posts
    28
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: 4test functions to find memory leaks in applications.

    Hi,

    You can try using the following function :
    lBytes = SYS_GetMemoryInfo (myWndTag, Counter);
    lBytes - The number of bytes of the performance counter specified by Counter. myWndTag - The window.
    Counter -The performance counter.

    You can use this function (most likely with WORKING_SET or PRIVATE_READWRITE) to get an indication of whether the application under test has a memory leak or not.


    ------------------

  3. #3
    Junior Member
    Join Date
    May 2001
    Location
    New Delhi , India
    Posts
    28
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: 4test functions to find memory leaks in applications.

    Some other useful information :

    The following instructions and example show you how to detect a memory leak.

    To detect a memory leak :

    Create a CMemoryState object and call the Checkpoint member function to get the initial snapshot of memory.

    After you perform the memory allocation and deallocation operations, create another CMemoryState object and call Checkpoint for that object to get a current snapshot of memory usage.

    Create a third CMemoryState object, call the Difference member function, and supply the previous two CMemoryState objects as arguments. The return value for the Difference function will be nonzero if there is any difference between the two specified memory states, indicating that some memory blocks have not been deallocated.
    The following example shows how to check for memory leaks:

    // Declare the variables needed
    #ifdef _DEBUG
    CMemoryState oldMemState, newMemState, diffMemState;
    oldMemState.Checkpoint();
    #endif

    // do your memory allocations and deallocations...
    CString s = "This is a frame variable";
    // the next object is a heap object
    CPerson* p = new CPerson( "Smith", "Alan", "581-0215" );

    #ifdef _DEBUG
    newMemState.Checkpoint();
    if( diffMemState.Difference( oldMemState, newMemState ) )
    {
    TRACE( "Memory leaked!\n" );
    }
    #endif

    Notice that the memory-checking statements are bracketed by #ifdef _DEBUG / #endif blocks so that they are compiled only in Win32 Debug versions of your program.

    On the other hand , some tools like Purify [ Rational ] and NT Task Manager can give you suffcient information to detect memory leaks in the running application.

    Hope this helps!

    Grover.

    ------------------

  4. #4
    Junior Member
    Join Date
    May 2001
    Location
    New Delhi , India
    Posts
    28
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: 4test functions to find memory leaks in applications.

    Hi,

    Here is a simple 4Test Script which when run in parallel with the application being debugged [ i.e. memory leak testing ].

    This is a crude script and can be improved a lot , but would serve as a template for you.

    use "D:\Quality Assurance\QAP Test Scripts\frame.inc";
    testcase MyBaseState () appstate none
    {
    Shell_TrayWnd1.PushButton1.Click ();
    Shell_TrayWnd1.TypeKeys ("<r>");
    Run.Open.SetText ("taskmgr");
    Run.OK.Click ();
    }
    testcase TaskMgr () appstate none
    {
    INTEGER iCounter = 1;
    INTEGER iPosition = 1;
    LIST OF STRING lsPages;
    LIST OF STRING lsImageName;
    LIST OF STRING lsMemUsage;
    STRING sColumnName;
    const sProcess = "MDM.EXE";
    if (! WindowsTaskManager.IsEnabled ())
    {
    WindowsTaskManager.SetActive ();
    }
    lsPages = WindowsTaskManager.PageList1.GetContents ();
    WindowsTaskManager.PageList1.Select ("Processes");
    for iCounter = 1 to 100
    {
    lsImageName = WindowsTaskManager.DialogBox1.ListView1.GetContent s (1);
    iPosition = ListFind (lsImageName, sProcess);
    lsMemUsage = WindowsTaskManager.DialogBox1.ListView1.GetContent s (5);
    Print ("{lsMemUsage[iPosition]}");
    Sleep (0.5);
    iCounter++;
    }
    }


    Hope this helps!!!

    Grover.

    ------------------

 

 

Posting Permissions

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

vBulletin Optimisation provided by vB Optimise v2.6.0 Beta 4 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
User Alert System provided by Advanced User Tagging v3.0.9 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Questions / Answers Form provided by vBAnswers (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
vBNominatevBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Feedback Buttons provided by Advanced Post Thanks / Like (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Username Changing provided by Username Change (Free) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
BetaSoft Inc.
Digital Point modules: Sphinx-based search
All times are GMT -8. The time now is 05:41 AM.

Copyright BetaSoft Inc.