none
Is it possible to get the memory usage for all the Dll's associated with the specified process using c++?

    Question

  • Hi

    I have to created few dlls and am trying to load few of the dlls from exe and the loaded dll inturn load other dlls.I have to measure the memory usage of individual dll or its process.

    I developed my application in vc++ using the IDE, visual studio 2010 .Is there any API to get the memory usage  of a process?

    Thanks in advance,

    vanitha

    Thursday, July 25, 2013 10:05 AM

Answers

  •  Hi Vanitha,

    Normally we are allocating memory using CRT functions.

    Before start to find out the memory usage of dll please have a basic idia about
    CRT heap , process heap, etc

    You could easily track down the memory usage at any point using many useful CRT functions.
    _CrtMemState,etc
    Memory state comparison

    About CRT - Article about CRT

    Memory leak detection using CRT

    thanks,
    Bhash



    Thursday, July 25, 2013 11:10 AM
  • you can use the process explorer tool which is free from here and select the dll/handle icon to view all the loaded dlls for the process, and in that column you can configure the WS private bytes options to see memory allocation specific to dll.

    Working Set(WS)- Working Set is the current size, in bytes, of the Working Set of this process. The Working Set is the set of memory pages touched recently by the threads in the process. If free memory in the computer is above a threshold, pages are left in the Working Set of a process even if they are not in use. When free memory falls below a threshold, pages are trimmed from Working Sets. If they are needed they will then be soft-faulted back into the Working Set before leaving main memory.

    Private Bytes- Private Bytes is the current size, in bytes, of memory that this process has allocated that cannot be shared with other processes.

    Saturday, July 27, 2013 10:00 AM

All replies

  •  Hi Vanitha,

    Normally we are allocating memory using CRT functions.

    Before start to find out the memory usage of dll please have a basic idia about
    CRT heap , process heap, etc

    You could easily track down the memory usage at any point using many useful CRT functions.
    _CrtMemState,etc
    Memory state comparison

    About CRT - Article about CRT

    Memory leak detection using CRT

    thanks,
    Bhash



    Thursday, July 25, 2013 11:10 AM
  • Every thing will become the part of the process and you want to see memory allocations made by threads executing code that resides in a specific DLL. In that scenario this is  not possible.

    Thanks


    Rupesh Shukla

    Thursday, July 25, 2013 1:34 PM
  •  Hi Vanitha,

    Normally we are allocating memory using CRT functions.

    Before start to find out the memory usage of dll please have a basic idia about
    CRT heap , process heap, etc

    You could easily track down the memory usage at any point using many useful CRT functions.
    _CrtMemState,etc
    Memory state comparison

    About CRT - Article about CRT

    Memory leak detection using CRT

    thanks,
    Bhash



    Hi vanitha vadivel,

    Refer  the article provided by Bhash , we can know different kinds of CRT  (single thread CRT, multi-thread CRT or multi-thread DLL CRT)  will bring different DLL memory allocation ways. For example, if your program and DLL link with a multi-threaded or single-threaded CRT, your program and DLL will use different heaps. While if multi-threaded DLL CRT, your program and DLL will share a common heap.

    I think maybe if we can have a good use of new/delete  or malloc/free beyond the DLL boundaries , maybe we can  use multi-thread CRT to make different DLL to have its own heap, then we can get each DLL memory allocation.

    Best Regards!

    Thank you for your post to make me learn more about this.


    May Wang
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Saturday, July 27, 2013 8:48 AM
    Moderator
  • you can use the process explorer tool which is free from here and select the dll/handle icon to view all the loaded dlls for the process, and in that column you can configure the WS private bytes options to see memory allocation specific to dll.

    Working Set(WS)- Working Set is the current size, in bytes, of the Working Set of this process. The Working Set is the set of memory pages touched recently by the threads in the process. If free memory in the computer is above a threshold, pages are left in the Working Set of a process even if they are not in use. When free memory falls below a threshold, pages are trimmed from Working Sets. If they are needed they will then be soft-faulted back into the Working Set before leaving main memory.

    Private Bytes- Private Bytes is the current size, in bytes, of memory that this process has allocated that cannot be shared with other processes.

    Saturday, July 27, 2013 10:00 AM