[ODE] Stack overflow

Marco Grubert mgrubert at conitec.net
Tue Feb 4 13:10:01 2003


> Could anyone please find out how the Windows Kernel handles large stack
> reservations, i.e. if it's okay to reserve the 2Gigs ?

No one did, so I posted to Usenet. Here's the response for interested
parties:

> When you set the reserve size, you're basically allocating space for the
> page tables for the stack.  Each megabyte of stack space requires one 4K
> page of page table entries (actually, the way NT/2k/XP work, it's
> somewhat higher than that).  That's fairly low overhead on a percentage
> basis, but (for example) reserving a gigabyte of stack space means
> allocating (at least) 4 megabytes for the page tables to map it.

So it's ca. 4k per Meg of reserved stack plus setting up the tables
- for each new thread.

  Marco Grubert
  Conitec Datasystems Inc.
  http://www.3dgamestudio.net/a4info.htm