Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.0k views
in Technique[技术] by (71.8m points)

visual c++ - Unmanaged VC++ Application's memory consumption on windows server

OK, so I have a very large multi-threaded unmanaged c++ application (server) that runs on a windows 2003 server. It hosts sessions for 20-50 concurrent users doing all sorts of business logic... At times it can be using a very large amount of memory due to things like object/session caching due to users having large numbers of windows open in the clients (each window has a separate server 'session'.

We routinely see consumption of more than 5-600 MB physical memory and 5-600 MB of virtual memory. Once it gets to this point we seem to start having 'out of memory' errors.

Now I know that Windows will start page-faulting when it feels it needs to free up physical memory, and also that win32 applications normally are only able to allocate up to a maximum of 4GB worth of memory, really only with 2GB of that available for actual use by the application for 'user-mode' address space, and even less of that after other libraries are loaded... I'm not sure if the 'user-mode' memory usage is what is reported on the Task Manager...

So anyway my real question is:

How can I find out how much user-mode memory my application has access to, and how much has been used at any given time (preferably from outside of the application, i.e. some windows management tool)?

[edit] After looking at the Process Explorer and the website, it looks like the value 'Virtual Size' is the value of how much memory the application has access to.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Sounds like a case for Process Explorer, a free utility from Microsoft SysInternals:

alt text
(source: microsoft.com)

Description:

Ever wondered which program has a particular file or directory open? Now you can find out. Process Explorer shows you information about which handles and DLLs processes have opened or loaded.

The Process Explorer display consists of two sub-windows. The top window always shows a list of the currently active processes, including the names of their owning accounts, whereas the information displayed in the bottom window depends on the mode that Process Explorer is in: if it is in handle mode you'll see the handles that the process selected in the top window has opened; if Process Explorer is in DLL mode you'll see the DLLs and memory-mapped files that the process has loaded. Process Explorer also has a powerful search capability that will quickly show you which processes have particular handles opened or DLLs loaded.

The unique capabilities of Process Explorer make it useful for tracking down DLL-version problems or handle leaks, and provide insight into the way Windows and applications work.


If you are looking for more info in terms of terminal-server specific info, I've been following the blog of a programmer that is releasing a beta of a tool that I believe will fit your needs perfectly. It is an improved TSAdmin. He calls it TSAdminEx.

See below for a screenshot, and click here to learn more about it and to get the beta. It's free software, BTW.

alt text


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...