Microsoft KB Archive/94840

From BetaArchive Wiki

Physical Memory Limits Number of Processes/Threads

Q94840



The information in this article applies to:


  • Microsoft Win32 Application Programming Interface (API), included with:
    • the operating system: Microsoft Windows NT, versions 3.1, 3.5



Each time Windows NT creates an object, such as a process or a thread, it must allocate a certain amount of physical memory (nonpaged pool) for its support. The amount of memory that is needed for support of a process object is significantly higher than the memory requirement for support of a thread object. The amount of memory that is required for a thread object on a RISC machine is higher than the memory requirement for a thread on an x86 machine, due to the greater number and size of registers on the RISC machines.

Due to the physical memory requirement of processes and threads, programs that use the CreateProcess() and CreateThread() APIs should be careful to check their return codes to detect out-of-memory conditions.

On Windows NT 3.5, each time a process is created it reserves the minimum working set of memory. On a 32 MB system, the default minimum working set is 200 KB. Therefore, on a 32 MB system, you can create ~100 processes. You can lower your minimum working set to 80 KB (the lowest allowed) with the following call:

SetProcessWorkingSetSize( (HANDLE)(-1), 20*4096, 100*4096 );

Additional query words: 3.10 3.50

Keywords :
Issue type :
Technology : kbAudDeveloper kbWin32sSearch kbWin32API


Last Reviewed: October 22, 2000
© 2001 Microsoft Corporation. All rights reserved. Terms of Use.