Microsoft Windows CE 3.0  

The Stack

Important:
This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.

The stack is the storage area for variables that are referenced in a function. Windows CE manages a separate stack for every thread in the system. The actual architecture of the stack is dependent on the microprocessor, but typically the default stack limit is 1MB, with 2 KB reserved for overflow control. You can override the stack limit at compile time, with the linker option, /STACK. You cannot change the stack limit for a thread when you call CreateThread; Windows CE ignores this parameter.

When a thread is created, Windows CE reserves enough memory space to accommodate the maximum stack size, and allocates one page of memory to the thread. As the stack grows, the system commits virtual pages from the top down. If no memory space is available, the thread needing the stack space is suspended until the request can be granted and the system will attempt to reclaim reserved, but unused, stack memory from another thread.

Note   Exceeding the stack limit causes a system-access violation that shuts down your application. Also, stack frames can be no larger than one page each, or structured exception handling will fail.


 Last updated on Tuesday, May 18, 2004

© 2004 Microsoft Corporation. All rights reserved.