stack

Which goes on the stack or heap?

耗尽温柔 提交于 2019-12-01 15:08:45
问题 I am doing some studying and I came across a question that asks to show the correct memory diagram of the following code: int [] d1 = new int[5]; d1[0] = 3; Integer [] d2 = new Integer[5]; d2[0] = new Integer(3); ArrayList d3 = new ArrayList(); d3.add(3); Here is my attempt at a memory diagram, but it may be incorrect: I understand things like objects, instance variables, and "new" instances are all on the heap and things such as local variables and primitive types are on the stack, but I'm

Xcode stack trace not appearing in console

旧城冷巷雨未停 提交于 2019-12-01 15:00:55
问题 I am used to having a stack trace appear in the console when I don't catch an exception and it throws it back to the main function. Is there a build setting somewhere in Xcode 4.2 that I don't have on? Right now, it shows nothing in the console at all. 回答1: Try adding a breakpoint on exception. Click on the breakpoint's tab (cmd + 6) Click the add ('+') button bottom left. Click 'Add Exception Breakpoint...' Leave the defaults and click done. Now when an exception is thrown it should drop you

Segmentation fault when pushing on stack (NASM)

非 Y 不嫁゛ 提交于 2019-12-01 14:07:24
I'm trying to get a nasm program running. The following code: segment .data contAir: dt 1.11330e-10 constOil: dt 2.33656e-10 segment .text global calc calc: mov edx, 0 push ebp ;mov ebp, esp ;mov eax, [ebp + 8] ret I get a segmentation fault (core dump) when pushing ebp on the stack. Why is that? I'm running this code on an Ubuntu virtual machine. Funny thing is, sometimes I get an "illegal instruction" error. I get a segmentation fault (core dump) when pushing ebp on the stack. Why is that? I'm running this code on an Ubuntu virtual machine. Funny thing is, sometimes I get an "illegal

How to send 4000+ requests in exactly 1 second?

折月煮酒 提交于 2019-12-01 13:50:57
问题 I have an HTTP GET request . I need to send the request to the application server for more than 4000 times exactly in 1 second. I'm sending these requests using JMeter. I have taken ethereal traces every time for each test using a sniffer tool ( Wireshark ). I have tried to achieve this from one machine, multiple machines (parallel) and even distributed mode. Actually, JMeter results are not my concern here. The concern of this test is to see that 4000 requests are hitting the server in one

How is a variable of type Variant with value Empty represented on the stack?

故事扮演 提交于 2019-12-01 13:18:12
The following explanation is from the Rhino Developer Docs Empty When you declare a variable in VBScript, the variable’s value before the first assignment is undefined, or Empty . Dim varValue ' Empty value So basically, Empty says “I am an uninitialized variant.” If you need to detect whether a variable actually is an empty variant and not a string or a number, you can use IsEmpty . Alternatively, you could use TypeName or VarType , but IsEmpty is best. So Empty is used for declaring variables. If you declare a variable, you reserve storage at the stack, but what is the value of Empty on the

Segmentation fault when pushing on stack (NASM)

纵然是瞬间 提交于 2019-12-01 12:29:39
问题 I'm trying to get a nasm program running. The following code: segment .data contAir: dt 1.11330e-10 constOil: dt 2.33656e-10 segment .text global calc calc: mov edx, 0 push ebp ;mov ebp, esp ;mov eax, [ebp + 8] ret I get a segmentation fault (core dump) when pushing ebp on the stack. Why is that? I'm running this code on an Ubuntu virtual machine. Funny thing is, sometimes I get an "illegal instruction" error. 回答1: I get a segmentation fault (core dump) when pushing ebp on the stack. Why is

Behaviour of ebp and esp in stacks using function with parameter

橙三吉。 提交于 2019-12-01 11:27:11
i want to learn more about stack. Especially, what happens when a function with parameter are called. For this, i write the following code: #include <stdio.h> int sum(int d, int e, int f){ int result = d + e + f; return result; } int main(void){ int a = 5; int b = 4; int c = 2; int erg = sum(a,b,c); printf("Result is: %d", erg); } and I get the following Assembly-Code(I will only add the part of the main function, because first I want to understand this section): push ebp, mov ebp, esp and esp, -16 sub esp, 32 mov DWORD PTR[esp+28], 5 mov DWORD PTR[esp+24], 4 mov DWORD PTR[esp+20], 2 mov eax,

Cmake change stack size

◇◆丶佛笑我妖孽 提交于 2019-12-01 11:02:11
Is there a way to change stack size from the Cmake ? I only found one forum thread mentioning CMAKE_CXX_STACK_SIZE but I couldn't find the documentation for this command. Ideally the command should work for both Visual Studio C++ and gcc . I don't have VS at the moment, but the following three CMake commands all work for me on MinGW/GCC (replace <target> with what you entered into add_executable() ): target_link_libraries(<target> PRIVATE "-Wl,--stack,10000000") OR set_target_properties(<target> PROPERTIES LINK_FLAGS -Wl,--stack,10000000) OR set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS

C++ force stack unwinding inside function

非 Y 不嫁゛ 提交于 2019-12-01 09:51:33
问题 I'm in the process of learning C++ and currently I'm fiddling with the following code: class Bar; struct Callback { virtual void Continue(Bar&) = 0; }; // ... void Foo(Bar& _x, Callback& result) { // Do stuff with _x if(/* some condition */) { // TODO: Force unwind of stack result.Continue(_x); return; } // Do more stuff with _x if(/* some other condition */) { // TODO: Force unwind of stack result.Continue(_x); return; } // TODO: Force unwind of stack Bar y; // allocate something on the

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

笑着哭i 提交于 2019-12-01 09:24:25
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 and it already does that well. There's no problem with stack demands from OS calls; my functions don't