Environment.WorkingSet issue RRS feed

  • Question

  • Environment.WorkingSet returns the working set incorrectly for my asp.net application which is the only application in its application pool.

    On a Windows 2003 Server SP2 with 3GBs of Ram, it reports working set as 2.047.468.061 bytes(1952MBs) and Process.WorkingSet value is 75.563.008 bytes(72MBs).

    • Memory Status values returned by GlobalMemoryStatusEx:
      ullAvailExtendedVirtual : 0
      ullAvailPageFile: 4.674.134.016
      ullAvailVirtual: 1.347.272.704
      ullTotalPageFile: 6.319.915.008
      ullTotalPhys: 3.245.568.000
      ullTotalVirtual: 2.147.352.576
    • GetProcessMemoryInfo() Working Set : 55.140.352 Peak Working Set: 75.571.200 PageFile : 94.560.256 QuotaPagedPoolUsage : 376.012 QuotaNonPagedPoolUsage : 33.261
    • GetProcessWorkingSetSize() - min : 204.800 - max : 1.413.120

    On a Vista machine with 3GBs of Ram, Environment.WorkingSet and Process.WorkingSet values are similar and around 37 MBs.

    So, why Environment.WorkingSet returns a fixed value. Restarting the application pool does not change anything, it always return the same magic value, 2.047.468.061.

    Tuesday, August 3, 2010 4:46 PM

All replies

  • Hi,

      Thanks for your post. The Environment.WorkingSet indicates how much physical memory is mapped to the Process's address space. Since page size used in Windows is 4096, the working set value should always be a multiple of 4096. The Process.WorkingSet value 75.563.008 is a reasonable multiple of 4096. But the 2.047.468.061 apparently is not. So how did you get this value? Could provide some more details?

       The following article is relevant

       RAM, Virtual Memory, Pagefile and all that stuff

    Please mark the right answer at right time.
    • Edited by SamAgain Thursday, August 5, 2010 4:58 AM refine
    Thursday, August 5, 2010 4:09 AM
  • i have no access to the windows 2003 server, its a shared hosting server and they do not have any support for debugging the application or provide some diagnostic information about the applications and the machine. so i don't know or guess much what causes it. it works well on my local machine with reasonable working set value.

    if i have access to the source code of mscorlib.dll i might find out what is going on.


    Friday, August 6, 2010 8:01 AM
  • Hi,

    If no access could be made to the server, it's difficult to find a reasonable solution. The source code of mscorlib.dll is not publicly available. But the debug symbols could be downloaded here if necessary.

    Please mark the right answer at right time.
    • Marked as answer by SamAgain Thursday, August 12, 2010 9:14 AM
    • Unmarked as answer by lockedscope Thursday, August 12, 2010 6:32 PM
    Tuesday, August 10, 2010 10:01 AM
  • We temporarily mark a reply, please remember to click "Mark as Answer" on the post that helps you, and to click "Unmark as Answer" if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.
    Please mark the right answer at right time.
    Thursday, August 12, 2010 9:14 AM