Thread Constructor (ThreadStart, Int32)

Note: This constructor is new in the .NET Framework version 2.0.

Initializes a new instance of the Thread class, specifying the maximum stack size for the thread.

Namespace: System.Threading
Assembly: mscorlib (in mscorlib.dll)

public Thread (
	ThreadStart start,
	int maxStackSize
public Thread (
	ThreadStart start, 
	int maxStackSize
public function Thread (
	start : ThreadStart, 
	maxStackSize : int



A ThreadStart delegate that represents the methods to be invoked when this thread begins executing.


The maximum stack size to be used by the thread.

Exception typeCondition


start is a null reference (Nothing in Visual Basic).


maxStackSize is less than 128K (131,072).

Avoid using this constructor overload. The default stack size used by the Thread(ThreadStart) constructor overload is the recommended stack size for threads. If a thread has memory problems, the most likely cause is programming error, such as infinite recursion.

If you specify a very small stack size, you might need to disable stack-overflow probing. When the stack is severely constrained, the probing can itself cause a stack overflow. To disable stack overflow probing, add the following to your application configuration file.

    <disableStackOverflowProbing enabled="true"/>

Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.

.NET Framework

Supported in: 2.0

.NET Compact Framework

Supported in: 2.0