stack-overflow

determine stack depth in javascript using javascript

不问归期 提交于 2019-12-05 05:34:46
Is there a way to determine the stack depth of all functions being executed in javascript by using javascript itself? I'm thinking it might involve modifying the Function prototype, but I really don't have any idea. Additionally, it would be nice to be able to break anytime the stack depth were sufficiently high. The reason for this is that I have a stack overflow error in IE which is apparently not debuggable . I'm lazy and I would rather not have to hunt through the code that I'm maintaining to find the cause. Thanks for assisting my laziness. ECMAscript supported for quite a while the

Android StackOverflowError in ViewGroup.resetResolvedTextDirection

谁说我不能喝 提交于 2019-12-05 05:27:21
I just went to android market to publish an update to my app and noticed there a few new errors reported from existing installs. While I can understand (and attempt to do something about) most of them, this one leaves me rather puzzled: java.lang.StackOverflowError at android.view.ViewGroup.resetResolvedTextDirection(ViewGroup.java:5131) at android.view.ViewGroup.resetResolvedTextDirection(ViewGroup.java:5131) at android.view.ViewGroup.resetResolvedTextDirection(ViewGroup.java:5131) at android.view.ViewGroup.resetResolvedTextDirection(ViewGroup.java:5131) at android.view.ViewGroup

Will recursively calling a function from a callback cause a stack overflow?

♀尐吖头ヾ 提交于 2019-12-05 04:15:53
I want to invoke a function after an event gets fired then in the same call back call the function again. This is to create a sort of event listener when the function completes. You'll know what i'm trying to do when you see the code: "use strict"; var page = require('webpage').create(); var system = require('system'); function onStdReadLine(callback) { system.stdin.readLineAsync(function(err, line) { callback(line); onStdReadLine(callback); }); } onStdReadLine(function(line) { // do something when the line comes in system.stdout.writeLine(line); }); Question: Could this potentially cause a

Stack overflow at line 0

。_饼干妹妹 提交于 2019-12-05 03:53:07
I have a form validation script that is unfortunately returning the Stack overflow at line 0 alert box shortly before crashing (IE7) and just straight up crashes in IE8 (It does work first, very slowly). I have made a jsFiddle for your testing pleasure: http://jsfiddle.net/yuNXm/2/ the stack overflow occurs after you have entered a value into an input which requires validation and then lose it's focus. (the email field is ajax driven so won't function there). The relevant Javascript: jQuery(document).ready(function($) { var inputs = $('input[data-validation-method]'); var fields = $(); var

Why would a C++ program allocate more memory for local variables than it would need in the worst case?

廉价感情. 提交于 2019-12-05 02:33:53
Inspired by this question . Apparently in the following code: #include <Windows.h> int _tmain(int argc, _TCHAR* argv[]) { if( GetTickCount() > 1 ) { char buffer[500 * 1024]; SecureZeroMemory( buffer, sizeof( buffer ) ); } else { char buffer[700 * 1024]; SecureZeroMemory( buffer, sizeof( buffer ) ); } return 0; } compiled with default stack size (1 megabyte) with Visual C++ 10 with optimizations on (/O2) a stack overflow occurs because the program tries to allocate 1200 kilobytes on stack. The code above is of course slightly exaggerated to show the problem - uses lots of stack in a rather dumb

Stack overflow - static memory vs. dynamic memory

随声附和 提交于 2019-12-05 01:53:30
问题 If you write int m[1000000]; inside the main function of C/C++, it will get a runtime error for stack overflow. Instead if you write vector<int> m; and then push_back 1000000 elements there, it will run fine. I am very curious about why this is happening. They both are local memory, aren't they? Thanks in advance. 回答1: Yes, the vector itself is an automatic (stack) object. But the vector holds a pointer to its contents (an internal dynamic array), and that will be allocated on the heap (by

Why doesn't this recursion produce a StackOverFlowException?

夙愿已清 提交于 2019-12-05 01:23:50
What is wrong with this code: using System; namespace app1 { static class Program { static int x = 0; static void Main() { fn1(); } static void fn1() { Console.WriteLine(x++); fn1(); } } } I compile this piece of code using this command: csc /warn:0 /out:app4noex.exe app4.cs When I double click on the exe, it doesn't seem to throw the exception (StackOverFlowException), and keep running forever. Using visual studio command prompt 2010, but I also have vs 2012 installed on the system, all up to date. Because the optimizer unrolls the tail recursion call into: static void fn1() { START: Console

return to libc - problem

最后都变了- 提交于 2019-12-04 21:41:30
问题 I'm having problems with return-to-libc exploit. The problem is that nothing happens, but no segmentation fault (and yes I'm actually overflowing the stack). This is my program: int main(int argc, char **argv) { char array[512]; gets(array); } I'm using gets instead of strcopy, because my addresses start with 0x00 and strcpy thinks it's the end of a string, so I can't use it. Here are the addresses that I need: $ gdb main core (gdb) p system $1 = {<text variable, no debug info>} 0x179680

Quicksort (Java) causes StackOverFlow at array.length > 60k

浪尽此生 提交于 2019-12-04 13:38:53
My code works properly (to my knowledge) up until my input array size ( a.length ) is around 62,000 at which time I consistently get a StackOverFlowError . I previously had used 2 recursive calls to quicksort (less than, and greater than the pivot q ) and then I switched to tail recursion. As you can see, I'm selecting the pivot to be the value at the end of the array. I know this isn't the best way to choose a pivot, but I still shouldn't be seeing StackOverFlowError s with an array size this small, right? What could be causing this? Thanks in advance! Here's my code: public static void

runtime: goroutine stack exceeds 1000000000-byte limit, fatal error: stack overflow on printing a nested struct

淺唱寂寞╮ 提交于 2019-12-04 12:23:29
I have a nested struct. type ConfigOne struct { // Daemon section from config file. Daemon daemon } type daemon struct { Loglevel int Logfile string } And I have a String() string method on that type, which I am trying to return the nested struct elements as func (c ConfigOne)String() string{ return fmt.Sprintf("%+v\n", c) } When I am trying to print it as c := &modules.ConfigOne{} c.Daemon.Loglevel = 1 c.Daemon.Logfile = "/tmp/test.log" modules.Logger.Infoln(c.String()) I am getting the error runtime: goroutine stack exceeds 1000000000-byte limit fatal error: stack overflow runtime stack: