stack-size

thread stack size on Windows (Visual C++)

巧了我就是萌 提交于 2019-11-29 06:32:32
Is there a call to determine the stack size of a running thread? I've been looking in MSDN thread functions documentation, and can't seem to find one. Whilst there isn't an API to find out stack size directly, contiguous virtual address space must be reserved up to the maximum stack size - it's just that a lot of that space isn't committed yet. You can take advantage of this and make two calls to VirtualQuery . For the first call, pass it the address of any value on the stack to get the base address and size, in bytes, of the committed stack space. On an x86 machine where the stack grows

Is stack memory contiguous physically in Linux?

梦想与她 提交于 2019-11-28 08:42:12
问题 As far as I can see, stack memory is contiguous in virtual memory address, but stack memory is also contiguous physically? And does this have something to do with the stack size limit? Edit: I used to believe that stack memory doesn't has to be contiguous physically, but why do we think that stack memory is always quicker than heap memory? If it's not physically contiguous, how can stack take more advantage of cache? And there is another thing that always confuse me, cpu executes directives

How to determine Stack size of a Program in linux?

我的梦境 提交于 2019-11-28 04:00:54
问题 How does one determine the current stack size of a program in linux? it is said that the stack size of each program will be 8 MB in linux but when you use cat /proc//mmap it shows a different size. Also, how does one determine stack size of associated threads? Since it is said that threads have their own private stack? 回答1: If you simply want the current stack size, you could declare a variable at the top of main(), take its address, and compare it to the address of a variable declared at

How do I increase the stack size when compiling with Clang on OS X?

强颜欢笑 提交于 2019-11-27 03:18:17
问题 Can I specify the stack size with clang++? I can't find any compiler options that would allow me to do so. I'm using OS X. Note: This question specifically refers to Clang, not the GCC compiler. 回答1: The linker, rather than the compiler, is responsible for setting the stack size of the main thread. The man page for ld contains the following: -stack_size size Specifies the maximum stack size for the main thread in a program. Without this option a program has a 8MB stack. The argument size is a

Can one obtain actual stack size used by a thread in Java after some time of running?

旧城冷巷雨未停 提交于 2019-11-26 23:20:58
问题 The idea would be to help determine the optimum stack size for a given Java application. One thing that could be done with this information create a range-table of stack sizes which the threads could modify as they exit and which could be dumped periodically and at application exit. EDIT: This is in the context of running on customer machines with real workloads which I can't get profiler access to. EDIT2: In response to one answer, at (IIRC) 256Kb per thread, I have wondered for a while now

Why is stack size in C# exactly 1 MB?

允我心安 提交于 2019-11-26 19:27:33
Today's PCs have a large amount of physical RAM but still, the stack size of C# is only 1 MB for 32-bit processes and 4 MB for 64-bit processes ( Stack capacity in C# ). Why the stack size in CLR is still so limited? And why is it exactly 1 MB (4 MB) (and not 2 MB or 512 KB)? Why was it decided to use these amounts? I am interested in considerations and reasons behind that decision . You are looking at the guy that made that choice. David Cutler and his team selected one megabyte as the default stack size. Nothing to do with .NET or C#, this was nailed down when they created Windows NT. One

Why is the max recursion depth I can reach non-deterministic?

℡╲_俬逩灬. 提交于 2019-11-26 12:28:39
I decided to try a few experiments to see what I could discover about the size of stack frames, and how far through the stack the currently executing code was. There are two interesting questions we might investigate here: How many levels deep into the stack is the current code? How many levels of recursion can the current method reach before it hits a StackOverflowError ? Stack depth of currently executing code Here's the best I could come up with for this: public static int levelsDeep() { try { throw new SomeKindOfException(); } catch (SomeKindOfException e) { return e.getStackTrace().length

Why is the max recursion depth I can reach non-deterministic?

前提是你 提交于 2019-11-26 03:36:14
问题 I decided to try a few experiments to see what I could discover about the size of stack frames, and how far through the stack the currently executing code was. There are two interesting questions we might investigate here: How many levels deep into the stack is the current code? How many levels of recursion can the current method reach before it hits a StackOverflowError ? Stack depth of currently executing code Here\'s the best I could come up with for this: public static int levelsDeep() {