From: Ge van Geldorp
From: Hartmut Birr
this patch (or some areas in ntoskrnl) isn't correct. This patch puts always 64kB between the TEB's. This limits the number of threads to 30,000 or less. I've found this by an other bug in kernel32.
Yes, you're right, that is an unwanted side effect. I think I'll change the TEB allocation to reserve 64k at a time and then commit 4k for each TEB, so we can have TEBs spaced tightly together again.
This is now implemented. I've successfully created and destroyed 600000 threads in a single process, so we should be ok I guess.
Ge van Geldorp.