stack

How do I get stack memory stats programatically?

痞子三分冷 提交于 2019-12-13 04:47:42
问题 I'm writing a simple memory reporting utility (in this particular situation using an existing tool is not an option). I've got it to print the max, commit and usage for all the memory pools returned by iterating ManagementFactory.getMemoryPoolMXBeans() . That gets me the three heap generations of heap memory (eden, survivor and old), the permgen, and the "code cache". None of these appear to be the method stack memory. The closest thing seems be the "code cache", but I've read that that's

java.lang.StackOverflowError exception for large inputs

那年仲夏 提交于 2019-12-13 04:30:04
问题 Basically, I'm writing a program to do a simple division manually where I want the decimal place upto 10^6 places. The program works for inputs <3000, but when I go higher, it shows: Exception in thread "main" java.lang.StackOverflowError Here's my code: { .... .... int N=100000;//nth place after decimal point String res=obj.compute(N,103993.0,33102.0,ans); //division of 103993.0 by 33102.0 System.out.println(res); } public String compute (int n, double a, double b, String ans){ int x1=(int)a

Can't figure out how to clear a linked list in c++?

梦想的初衷 提交于 2019-12-13 04:24:40
问题 I'm trying to figure out how to clear a stack (in the form of a linked list). Linked lists aren't my forte; I don't understand them at all. Here's my code, can anyone shed some light onto why it's not working? When I try to call the method through a switch in main, it seems too get stuck in an infinite loop. void stack :: clearStack() { if (isEmpty()== true) { cout << "\nThere are no elements in the stack. \n"; } else { node *current = top; node *temp; while(current != NULL); { current = temp

Most efficient way to reverse a stack and add to an ArrayList

岁酱吖の 提交于 2019-12-13 03:54:12
问题 I have two collections - an ArrayList and a Stack. I use the stack because I needed some simple pop/push functionality for this bit of code. The ArrayList is essentially the out variable as this is a small section of code in the function. So, the variables are defined as such, then code is run to add elements to the stack. ArrayList<String> out = new ArrayList<String>(); /* other code.. */ Stack<String> lineStack = new Stack<String>(); /* code that adds stuff to the stack */ The question is,

Stack contents during a function call

我怕爱的太早我们不能终老 提交于 2019-12-13 03:41:28
问题 I'm trying to understand what will be present on the stack during a function call. As far as I have learnt, arguments to the callee (if any), the return address of the caller and the base address would be pushed on the stack before calling another function. So, I wrote a simple C program #include <stdio.h> void foo() { } int main() { foo(); return 0; } and the corresponding dis-assembled machine code is 08048334 <foo>: 8048334: 55 push %ebp 8048335: 89 e5 mov %esp,%ebp 8048337: c9 leave

How can I get JUnit test (driven from Ant script) to dump the stack of exception that causes failure?

有些话、适合烂在心里 提交于 2019-12-13 03:35:53
问题 We run JUnit test from Ant script, as follows. When the test failed, I expect it to output the stack dump of the exception that casuses the failure, but it doesn't. Is there any trick to get it dumped? <target description="Run JUnit tests" name="run-junit" depends="build-junit"> <copy file="./AegisLicense.txt" tofile="test/junit/classes/AegisLicense.txt" overwrite="true"/> <junit printsummary="yes" haltonfailure="no" fork="yes" forkmode="once" failureproperty="run-aegis-junit-failed"

Ace Editor Pause/Disable UndoManager

谁都会走 提交于 2019-12-13 03:34:24
问题 Is there any way to remove specific stack value from UndoManager OR any function to pause/disable and start/enable UndoManager again. I want not to push specific data to UndoManager's stack . 回答1: It is not possible to simply not push deltas to the stack, since in that case undoing previous deltas won't be possible, you need to also transform the deltas around skipped delta. Say if you have a document "xyz" to which {insert, 2, "a"} is applied to obtain "xyaz" and then {insert, 1, "b"} to get

Visual Studio debug maximum buffer size

馋奶兔 提交于 2019-12-13 02:08:03
问题 When debugging my project in visual studio (2010) I get the message " no source available " once I step into one of my files. The file is now just a test file with one function: void foo() { float testbuf[200000] = {0}; } If i allocate a smaller buffer the debugger enters the file normally. In my debugging view my "call stack location" is empty and there is "no disassembly available". It looks to me like there is a maximum amount of data that the visual studio debugger can handle or something

C - Exception when using _int16 [duplicate]

别来无恙 提交于 2019-12-13 01:25:55
问题 This question already has answers here : Closed 7 years ago . Possible Duplicate: Correct way to use scanf / printf (and family) with fixed size types? I have written the following program in Visual Studio: Upon running the program and exiting, I get the error message "stack around variable b was corrupted". If I replace _int 16 with int, no exception is raised. How can I solve this problem please? I have to use _int16 since I want to simulate an integer overflow. Thanks :) 回答1: As pointed

Why use a pointer to a pointer to the stack when creating a push function?

允我心安 提交于 2019-12-12 23:44:52
问题 I am looking at a textbook example of a linked list that implements a stack. I don't understand why using a pointer to a pointer to the stack is necessary for the push operation. See the following example: bool push( Element **stack, void *data) { Element *elem = new Element; if(!elem) return false; elem->data = data; elem->next = *stack; *stack = elem; return true; } If anyone can help clarify why the first parameter of the push method is a pointer to a pointer, I would greatly appreciate it