多线程进程的最大堆栈大小
Maximum size of stack of multi threaded process
据我了解
- 进程的每个线程都有一个堆栈,而进程通常只有一个堆。
默认堆栈最大大小限制由 OS 设置。
- Windows-64 位:1MB
- Linux-64 位:8MB
此限制是否适用于进程级别或每个线程可以有 1MB/8MB 堆栈?
线程退出后分配给堆栈的内存会发生什么变化?
each thread of a process gets a stack, while there's typically only
one heap for the process.
没错。
Is this limit applicable at process level or each thread can have
1MB/8MB stack?
每个线程都有自己的堆栈; stack-size-limit 是 per-thread(即它不是进程中所有线程的共享限制)
And what happens to the memory allotted to stack after thread exit?
内存页已释放,可供将来其他代码使用。
each thread of a process gets a stack, while there's typically only one heap for the process.
前者是真的。后者是错误的。进程经常有多个堆,尤其是在 3d 方代码中链接时。
Is this limit applicable at process level or each thread can have 1MB/8MB stack?
每个线程。
And what happens to the memory allotted to stack after thread exit?
通常它们将保持分配给进程,直到进程退出并且地址 space 不再存在。
据我了解
- 进程的每个线程都有一个堆栈,而进程通常只有一个堆。
默认堆栈最大大小限制由 OS 设置。
- Windows-64 位:1MB
- Linux-64 位:8MB
此限制是否适用于进程级别或每个线程可以有 1MB/8MB 堆栈?
线程退出后分配给堆栈的内存会发生什么变化?
each thread of a process gets a stack, while there's typically only one heap for the process.
没错。
Is this limit applicable at process level or each thread can have 1MB/8MB stack?
每个线程都有自己的堆栈; stack-size-limit 是 per-thread(即它不是进程中所有线程的共享限制)
And what happens to the memory allotted to stack after thread exit?
内存页已释放,可供将来其他代码使用。
each thread of a process gets a stack, while there's typically only one heap for the process.
前者是真的。后者是错误的。进程经常有多个堆,尤其是在 3d 方代码中链接时。
Is this limit applicable at process level or each thread can have 1MB/8MB stack?
每个线程。
And what happens to the memory allotted to stack after thread exit?
通常它们将保持分配给进程,直到进程退出并且地址 space 不再存在。