stack

When does the stack really overflow?

允我心安 提交于 2019-12-18 04:23:10
问题 Is infinite recursion the only case or can it happen for other reasons? Doesn't the stack size grow as needed same as heap? Sorry if this question has been asked before, would appreciate links to them if that is the case. 回答1: I can't speak for all platforms, but as it happens, I've just spent some time working with Windows .exe files (I mean, actually studying the binary format of them - I know in a sense all of us here work with executable files ;) ). I'm betting that most other platforms

Is there a way to examine the stack variables at runtime in C#?

冷暖自知 提交于 2019-12-18 04:21:41
问题 Is there a way to dump the contents of the stack at runtime? I am interested in both the parent functions information (name, parameters, line) which I know I can get with the StackTrace and StackFrame classes. However, I would also like to get the variables in the stack (local variables declared in the method that called the one is currently executing). Since the Visual Studio debugger can do this, I think there may be a way to also do it at runtime within the code. Is there such a way? 回答1:

Is there a way to examine the stack variables at runtime in C#?

五迷三道 提交于 2019-12-18 04:21:04
问题 Is there a way to dump the contents of the stack at runtime? I am interested in both the parent functions information (name, parameters, line) which I know I can get with the StackTrace and StackFrame classes. However, I would also like to get the variables in the stack (local variables declared in the method that called the one is currently executing). Since the Visual Studio debugger can do this, I think there may be a way to also do it at runtime within the code. Is there such a way? 回答1:

Android Activity Stack is not working as stated in the docs - last activity in task stack not shown

痞子三分冷 提交于 2019-12-18 03:46:32
问题 According to Android docs: http://developer.android.com/guide/topics/fundamentals/tasks-and-back-stack.html "When the user leaves a task by pressing the Home button, the current activity is stopped and its task goes into the background. The system retains the state of every activity in the task. If the user later resumes the task by selecting the launcher icon that began the task, the task comes to the foreground and resumes the activity at the top of the stack." If I understand this

What is a safe Maximum Stack Size or How to measure use of stack?

回眸只為那壹抹淺笑 提交于 2019-12-18 02:48:53
问题 I have an app with a number of worker threads, one for each core. On a modern 8 core machine, I have 8 of these threads. My app loads a lot of plugins, which also have their own worker threads. Because the app uses huge blocks of memory (photos, eg. 200 MB) I have memory fragmentation problem. The problem is that every thread allocates the {$MAXSTACKSIZE ...} of address space. It's not using the physical memory but the adress space. I reduced the MAXSTACKSIZE from 1MB to 128KB and it seems to

How to mmap the stack for the clone() system call on linux?

谁说胖子不能爱 提交于 2019-12-18 01:15:09
问题 The clone() system call on Linux takes a parameter pointing to the stack for the new created thread to use. The obvious way to do this is to simply malloc some space and pass that, but then you have to be sure you've malloc'd as much stack space as that thread will ever use (hard to predict). I remembered that when using pthreads I didn't have to do this, so I was curious what it did instead. I came across this site which explains, "The best solution, used by the Linux pthreads implementation

Memory sharing between C++ threads

风流意气都作罢 提交于 2019-12-17 23:28:19
问题 I'm new to threading in C++, and I'm trying to get a clear picture about how memory is shared/not shared between threads. I'm using std::thread with C++11. From what I've read on other SO questions, stack memory is owned by only one thread and heap memory is shared between threads. So from what I think I understand about the stack vs. the heap, the following should be true: #include <thread> using namespace std; class Obj { public: int x; Obj(){x = 0;} }; int main() { Obj stackObj; Obj

How to get address of base stack pointer

独自空忆成欢 提交于 2019-12-17 22:40:39
问题 I am in the process of porting an application from x86 to x64. I am using Visual Studio 2009; most of the code is C++ and some portions are plain C. The __asm keyword is not supported when compiling towards x64 and our application contains a few portions of inline assembler. I did not write this code so I don't know exactly what et is supposed to do: int CallStackSize() { DWORD Frame; PDWORD pFrame; __asm { mov EAX, EBP mov Frame, EAX } pFrame = (PDWORD)Frame; /*... do stuff with pFrame here*

how bad is it to use dynamic datastuctures on an embedded system?

*爱你&永不变心* 提交于 2019-12-17 22:36:49
问题 So in an embedded systems unit, that i'm taking at uni next year, we will learn that dynamic data structures are a bad thing to have in an embedded system program. but the lecture notes don't go into why. Now i'm working on a moderate scale, embedded systems\ 'LURC' controller, mostly just takes advantages of the peripheral of the "Butterfly" demo board for the AVR169MEGA. produced 4 PWM signals to contol servo's and ESC. and also to provide an 9 seg LCD screen. Now I can't think of anybetter

What is between ESP and EBP?

被刻印的时光 ゝ 提交于 2019-12-17 22:29:33
问题 Right, I'm sure this is implicitly answered many times, but I seem not to be able to quite get to it. If you have a (x86) stack trace (say, looking at it in WinDbg), and you look at the registers, what does it mean for EBP and ESP values to be x bytes apart? Links: https://stackoverflow.com/a/3699916/321013 https://stackoverflow.com/a/2466587/321013 https://stackoverflow.com/a/5738940/321013 To give an example of a recent stack trace I had: 0:016> k ChildEBP RetAddr 1ac5ee8c 76b831bb ntdll