Article ID: 323635 - Last Review: January 6, 2006 - Revision: 4.2 You may experience a C-Runtime heap performance problem in a Visual C++ application that is running on Windows 2000 or on Windows XP
This article was previously published under Q323635 SYMPTOMS Under stress conditions that involve heavy memory use, a
program that was written in Visual C++ may perform better on a computer that is running
Microsoft Windows NT 4.0 than on a computer that is running Microsoft Windows 2000 or Microsoft Windows XP.
When you start the program, it seems to have similar or better performance on a computer running Windows 2000 or Windows XP, and then, after physical memory (RAM) is exhausted, the memory manager starts to use the pagefile. When this occurs, the program on the computer running Windows 2000 or Windows XP may slow down compared to the same program on the computer running Windows NT 4.0. When you view the Task Manager on the computer running Windows 2000 or Windows XP, the CPU usage may peak at 100 percent. CAUSE Typically, programs that are written in Visual C++ make
allocations through the C-Runtime (CRT). These allocations are handled
differently on a computer running Windows NT 4.0 than on a computer running
Windows 2000 or Windows XP. When the CRT detects that the program is running on
Windows NT 4.0, it uses its own small-block heap for small allocations. The CRT
does this to increase heap performance on Windows NT 4.0. In Windows 2000 and Windows XP, the heap manager has been improved so that the CRT does not need the small-block heap. On a computer running Windows 2000 or Windows XP, the CRT sends all of the allocations to the default process heap. However, under stress conditions, the use of the small-block heap on a computer running Windows NT 4.0 may cause memory operations to be more efficient than the same operations on a computer running Windows 2000 or Windows XP. RESOLUTION You can force the use of the small-block heap on all
operating systems. To do this, add the following code to the beginning of your
program: Note There may be other differences between operating systems that cause performance variations. This is only one potential cause. STATUSThis
behavior is by design. MORE INFORMATION Typically, the performance difference occurs only when
memory usage exceeds the physical memory. The symptoms also seem to be
influenced by the types and amounts of allocations that the program makes.
To improve performance, you can also evaluate the application's memory usage. The following are examples of what conditions to look for:
REFERENCES For more information about memory and performance, visit
the following Microsoft Web site: http://msdn.microsoft.com/en-us/library/ms810466.aspx
(http://msdn.microsoft.com/en-us/library/ms810466.aspx)
| Other Resources Other Support Sites
CommunityGet Help NowArticle Translations
|






Windows Live
Facebook
Twitter
Linkedin
Digg it
Yahoo
Delicious
StumbleUpon
Yammer
Reddit
Technorati
FriendFeed
Email
Back to the top
