monitor memory leak

This is a discussion on monitor memory leak within the Tech Board forums, part of the Community Boards category; Hello everyone, Reading from book Windows Internals, we should use private bytes to monitor memory leak. 1. I think the ...

  1. #1
    Registered User
    Join Date
    May 2006
    Posts
    1,579

    monitor memory leak

    Hello everyone,


    Reading from book Windows Internals, we should use private bytes to monitor memory leak.

    1. I think the reason why not using virtual bytes, is because there may be some shared materials counted as a part of virtual bytes -- like shared library and file map;

    2. I think the reason why not using working set, is because sometimes working set is trimmed and sometimes not all committed virtual bytes are in working set -- like demand for zero scenario.

    Are my understanding for (1) and (2) correct?


    thanks in advance,
    George

  2. #2
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Yes, if your system is swapping, then you can't use "working set", since that is not reflecting memory that has been unused for some time [e.g. "lost" allocations that are just sitting there, not actually being used].

    As for the virtual bytes, yes, that includes a bunch of "non-allocations" that may grow and shrink depending on various other matters, so don't necessarily indicate a memory leak.

    The best way to track memory leaks is to have a "memory leak detecting library" - there are several around.

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  3. #3
    Registered User
    Join Date
    May 2006
    Posts
    1,579
    Hi Mats,


    1.
    I am interested in the "memory leak detecting library" you mentioned. Could you recommend some your favorite please? :-)

    2.

    I am always relying on debug mode on Visual Studio, which will report how many bytes leaked. Is that approach reliable or have some limitations?


    Quote Originally Posted by matsp View Post
    The best way to track memory leaks is to have a "memory leak detecting library" - there are several around.

    --
    Mats

    regards,
    George

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Detecting memory leak in complicating source code
    By mosxopul in forum C++ Programming
    Replies: 5
    Last Post: 03-30-2009, 11:41 AM
  2. Question regarding Memory Leak
    By clegs in forum C++ Programming
    Replies: 29
    Last Post: 12-07-2007, 12:57 AM
  3. Is this a memory leak?
    By cboard_member in forum C++ Programming
    Replies: 9
    Last Post: 07-20-2005, 01:15 PM
  4. Memory leak trackers
    By Darkness in forum A Brief History of Cprogramming.com
    Replies: 5
    Last Post: 11-30-2004, 01:03 PM
  5. Why is this a memory leak?
    By deadpoet in forum C++ Programming
    Replies: 2
    Last Post: 02-20-2004, 10:16 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21