stack

How much is pushed onto a 32-bit stack under Windows x86-64 on an exception?

可紊 提交于 2019-12-19 09:56:47
问题 In this this question, I give some background on a parallel language I have implemented. The compiler generates native x86-32 code. A key implementation decision is to allocate stack space from the heap for every function (call). This allows for recursion until you run out of VM, and enables a cactus stack for lexical scopes even for nested parallel children, etc. The compiler's code generator can compute how much stack space is needed by the function itself; that's messy but straightforward

Is there any way to make Go's channels behave like a stack

跟風遠走 提交于 2019-12-19 09:27:25
问题 Go channels by default behave like a queue as far as I can tell, first in first out. Is there any way to change them to work last in first out? Basically I am doing a search and want to do DFS instead of BFS for memory constraints. 回答1: No, this is not possible - channels are always FIFO. You could use package container/heap. 来源: https://stackoverflow.com/questions/17755222/is-there-any-way-to-make-gos-channels-behave-like-a-stack

How to determine optimal thread stack size?

允我心安 提交于 2019-12-19 07:38:09
问题 Actually, two sizes: initially committed and total reserved. Do you use static or dynamic analysis? Which tools? Which techniques? 回答1: One technique is to paint your stack in main or the threads main with a known value and then on cleanup do a sweep from the stack limit until your known value is no longer found. Your stack end will be defined as a symbol, generate a .map file to determine the stack limits and their symbol names. It is discussed here: How to determine maximum stack usage? 来源:

is there a point in recycling value types unity

杀马特。学长 韩版系。学妹 提交于 2019-12-19 07:36:42
问题 I found article stating that recycling and reusing variables is good practice in unity. So I adopted it. But one thing not clear : does this apply to value type variables (integers, vectors)? is there a point i using this: int x; Vector3 v; void functionCalledVeryOften(){ x=SomeCalculation(); v=SomeCalc(); //do something with x and v } instead of this: void functionCalledVeryOften(){ int x=SomeCalculation(); Vector3 v=SomeCalc(); //do something with x and v } 回答1: This is fairly dependent on

Relation between stack limit and threads

天大地大妈咪最大 提交于 2019-12-19 07:24:36
问题 What is the relationship between ulimit -s <value > and the stack size (at thread level) in the Linux implementation (or for that matter any OS)? Is <number of threads > * <each thread stack size > must be less than < stack size assigned by ulimit command > valid justification? In the below program - each thread allocates char [PTHREAD_STACK_MIN] and 10 threads are created. But when the ulimit is set to 10 * PTHREAD_STACK_MIN, it does not coredump due to abort. For some random value of

Relation between stack limit and threads

南楼画角 提交于 2019-12-19 07:24:00
问题 What is the relationship between ulimit -s <value > and the stack size (at thread level) in the Linux implementation (or for that matter any OS)? Is <number of threads > * <each thread stack size > must be less than < stack size assigned by ulimit command > valid justification? In the below program - each thread allocates char [PTHREAD_STACK_MIN] and 10 threads are created. But when the ulimit is set to 10 * PTHREAD_STACK_MIN, it does not coredump due to abort. For some random value of

Check if given string is a palindrome using stack [closed]

若如初见. 提交于 2019-12-19 05:02:02
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 6 years ago . Folks, I was recently interviewed and got a question on Palindrome. Given a string ( which might represent a date ), check if it's a palindrome or not using Stack. I tried to come up with solution, but he didn't like that. Can anyone show me the code snippet for it in Java ? Thanks PS : This is not a homework,

Check if given string is a palindrome using stack [closed]

十年热恋 提交于 2019-12-19 05:01:52
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 6 years ago . Folks, I was recently interviewed and got a question on Palindrome. Given a string ( which might represent a date ), check if it's a palindrome or not using Stack. I tried to come up with solution, but he didn't like that. Can anyone show me the code snippet for it in Java ? Thanks PS : This is not a homework,

Searching for a particular element in a stack

邮差的信 提交于 2019-12-19 04:18:11
问题 I am interested in porting this Python code to C++. As part of the port, I am using std::stack from the <stack> header. How can I determine whether some character is contained within a stack<char> ? For example: std::stack<char> myStack if (!('y' is included in myStack)) // I know that this is wrong { } 回答1: The C++ stack does not support random access, so there is no direct way using a stack to check if an element is contained. You can, however, make a copy of the stack and then continuously

x86 Can push/pop be less than 4 bytes? [duplicate]

痞子三分冷 提交于 2019-12-19 03:12:13
问题 This question already has answers here : Why is it not possible to push a byte onto a stack on Pentium IA-32? (4 answers) Closed 4 years ago . Hi I am reading a guide on x86 by the University of Virginia and it states that pushing and popping the stack either removes or adds a 4-byte data element to the stack. Why is this set to 4 bytes? Can this be changed, could you save memory on the stack by pushing on smaller data elements? The guide can be found here if anyone wishes to view it: http:/