stack-overflow

Without using recursion how can a stack overflow exception be thrown?

落爺英雄遲暮 提交于 2019-12-01 17:48:56
Without using recursion how can a stack overflow exception be thrown? If you call enough methods, a stack overflow can occur anytime. Although, if you get stack overflow errors without using recursion, you may want to rethink how you're doing things. It's just so easy with recursion because in an infinite loop, you call a ton of methods. Since no one else has mentioned it: throw new System.StackOverflowException(); You might do this when testing or doing fault-injection. Declare an ENORMOUS array as a local variable. The following applies to Windows, but most OSs implement this in a similar

What is causing a stack overflow?

妖精的绣舞 提交于 2019-12-01 17:28:31
You may think that this is a coincidence that the topic of my question is similar to the name of the forum but I actually got here by googling the term "stack overflow". I use the OPNET network simulator in which I program using C. I think I am having a problem with big array sizes. It seems that I am hitting some sort of memory allocation limitation. It may have to do with OPNET, Windows, my laptop memory or most likely C language. The problem is caused when I try to use nested arrays with a total number of elements coming to several thousand integers. I think I am exceeding an overall memory

My regex is causing a stack overflow in Java; what am I missing?

非 Y 不嫁゛ 提交于 2019-12-01 17:15:57
I am attempting to use a regular expression with Scanner to match a string from a file. The regex works with all of the contents of the file except for this line: DNA="ITTTAITATIATYAAAYIYI[....]ITYTYITTIYAIAIYIT" in the actual file, the ellipsis represents several thousand more characters. When the loop that reads the file arrives on the line containing the bases, a stack overflow error occurs. Here is the loop: while (scanFile.hasNextLine()) { final String currentLine = scanFile.findInLine(".*"); System.out.println("trying to match '" + currentLine + "'"); Scanner internalScanner = new

Stack overflow despite tail call position but only in 64-bit

戏子无情 提交于 2019-12-01 17:09:02
问题 Originated from this question, I have this little F# code (github) to generate random values according to a normal distribution: // val nextSingle : (unit -> float32) let nextSingle = let r = System.Random() r.NextDouble >> float32 // val gauss : (float32 -> float32 -> seq<float32>) let gauss mean stdDev = let rec gauss ready = seq { match ready with | Some spare -> yield spare * stdDev + mean yield! gauss None | _ -> let rec loop () = let u = nextSingle() * 2.f - 1.f let v = nextSingle() * 2

What is causing a stack overflow?

柔情痞子 提交于 2019-12-01 16:27:09
问题 You may think that this is a coincidence that the topic of my question is similar to the name of the forum but I actually got here by googling the term "stack overflow". I use the OPNET network simulator in which I program using C. I think I am having a problem with big array sizes. It seems that I am hitting some sort of memory allocation limitation. It may have to do with OPNET, Windows, my laptop memory or most likely C language. The problem is caused when I try to use nested arrays with a

Regular Expression causing Stack Overflow

眉间皱痕 提交于 2019-12-01 16:18:49
问题 Further to my previous question: ECMAScript Regex for a multilined string, I have implemented the following loading procedure: void Load( const std::string& szFileName ) { static const std::regex regexObject( "=== ([^=]+) ===\\n((?:.|\\n)*)\\n=== END \\1 ===", std::regex_constants::ECMAScript | std::regex_constants::optimize ); static const std::regex regexData( "<([^>]+)>:([^<]*)\\n", std::regex_constants::ECMAScript | std::regex_constants::optimize ); std::ifstream inFile( szFileName );

Maven with an explicit finalName won't work properly

冷暖自知 提交于 2019-12-01 15:00:55
1. Background My maven project has a lot of modules and submodules with jars and wars and everything works. I also can deploy it on server without any problem. I decided to follow this maven naming conversion , I am making some tests with project.name and project.build.finalName to have an appropriate name. The pattern I defined to create project.name for the root artifact is company-${project.artifactId} and for the modules and sub-modules is ${project.parent.name}-${project.artifactId} : company-any-artifact-any-module1 company-any-artifact-any-module2-any-submodule1 company-any-artifact-any

Need a practical solution for creating pattern database(5-5-5) for 15-Puzzle

我是研究僧i 提交于 2019-12-01 13:20:21
For static pattern database(5-5-5), see this (page 290 and 283) OR there is an explanation below. For What is 15-puzzle? I am creating a static patter database(5-5-5). This code to to fill entries into the first table. I am doing it via the recursive function insertInDB() . The first input to the recursive function is this (actually the input puzzle contains it in 1-D array. For better understanding I have represented it as 2-D below) 1 2 3 4 0 6 0 0 0 0 0 0 0 0 0 0 This is my code : class DBClass { public Connection connection; public ResultSet rs; public PreparedStatement ps1; public

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

Need a practical solution for creating pattern database(5-5-5) for 15-Puzzle

两盒软妹~` 提交于 2019-12-01 09:50:23
问题 For static pattern database(5-5-5), see this(page 290 and 283) OR there is an explanation below. For What is 15-puzzle? I am creating a static patter database(5-5-5). This code to to fill entries into the first table. I am doing it via the recursive function insertInDB() . The first input to the recursive function is this (actually the input puzzle contains it in 1-D array. For better understanding I have represented it as 2-D below) 1 2 3 4 0 6 0 0 0 0 0 0 0 0 0 0 This is my code : class