+ Reply to Thread
Results 1 to 2 of 2

Thread: How to get memory of current process?

  1. #1
    Junior Member
    Join Date
    Apr 2012
    Posts
    46

    How to get memory of current process?

    Hi All,

    I want to get memory current process.

    How can I get it?

    Please Help.

  2. #2
    Junior Member
    Join Date
    Apr 2012
    Posts
    38
    GetProcessMemoryInfo can be used for this purpose.

    Following example shows how private bytes and working set can be displayed for current process.

    Example:

    Code:
    void GetCurrentProcesMemoryInfo()
    {
    	PROCESS_MEMORY_COUNTERS objProcessMemoryInfo ;
    
    	if (GetProcessMemoryInfo(GetCurrentProcess(), &objProcessMemoryInfo, sizeof(objProcessMemoryInfo)) )
    	{
    		char szProcessMemoryInfo[100] ;
    		sprintf(szProcessMemoryInfo, "Privtae Bytes (KB) : %d\n", objProcessMemoryInfo.PagefileUsage/1024) ;
    		OutputDebugString(szProcessMemoryInfo) ;
    		sprintf(szProcessMemoryInfo, "Working Set Bytes (KB): %d\n", objProcessMemoryInfo.WorkingSetSize/1024) ;
    		OutputDebugString(szProcessMemoryInfo) ;
    	}
    }

+ Reply to Thread

Tags for this Thread

Bookmarks

Posting Permissions

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