File tree Expand file tree Collapse file tree 1 file changed +12
-5
lines changed
starlark/src/eval/runtime Expand file tree Collapse file tree 1 file changed +12
-5
lines changed Original file line number Diff line number Diff line change @@ -179,11 +179,18 @@ impl<'v> Default for CheapCallStack<'v> {
179
179
}
180
180
}
181
181
182
- /// At 50 we see the C stack overflowing, so limit to 40 (which seems quite low...).
183
- ///
184
- /// Note some calls may be inlined (special functions like `len`
185
- /// or simple functions like `def f(): return 1`), so effectively call stack
186
- /// may be larger depending on what optimizations applied.
182
+ // Currently, each frame typically allocates about 1K of native stack size (see `test_frame_size`),
183
+ // but it is a bit more complicated:
184
+ // * each for loop in a frame allocates more native stack
185
+ // * inlined functions do not allocate native stack
186
+ // Practically max call stack depends on native stack size,
187
+ // and depending on environment, it may be configured differently, for example:
188
+ // * macOS default stack size is 512KB
189
+ // * Linux default stack size is 8MB
190
+ // * [tokio default stack size is 2MB][1]
191
+ // [1] https://docs.rs/tokio/0.2.1/tokio/runtime/struct.Builder.html#method.thread_stack_size
192
+ // TODO(nga): count loops in call stack size.
193
+ // TODO(nga): make it configurable.
187
194
const MAX_CALLSTACK_RECURSION : usize = 40 ;
188
195
189
196
unsafe impl < ' v > Trace < ' v > for CheapCallStack < ' v > {
You can’t perform that action at this time.
0 commit comments