stack-overflow

Attempting to use continuation passing style to avoid stack overflow with minimax algorithm

白昼怎懂夜的黑 提交于 2019-12-21 17:48:09
问题 Summary of my objective: Figure out how to use continuation-passing style to avoid a stack overflow when using an algorithm I believe cannot be made tail-recursive. Alternatively, find a way to make the function tail-recursive. Details: I am new to F# (and functional programming in general) and I am attempting to implement the minimax algorithm with alpha-beta pruning. This is an algorithm used to determine the best possible move for a two-player game. The pseudocode for the algorithm can be

Stack overflow in c# app using c++ dll

☆樱花仙子☆ 提交于 2019-12-21 16:57:08
问题 I've got a c# program which is using a c++/cli managed dll. The dll contains a lot of legacy code, consisting of quite a few win32 windows. Problem is, the windows in the dll need a bit more stackspace than average cough . Since these are not background processes but win32 api I need to enlarge the stack size of the GUI thread (at least I think the win32 api in the dll will use the main gui process). So I need a way to enlarge the size of the GUI thread in a c# process. Since I found no

Increasing stack space of a single worker-thread in java

拜拜、爱过 提交于 2019-12-21 12:55:44
问题 In my java web application, I have a single background-worker thread, which requires a lot of stack space, because it runs a really complex workflow using the activiti workflow engine and groovy script tasks. Currently I need to set the JVM Xss setting as high as 16MB on a 64bit Java and Tomcat, to circumvent any StackOverflowErrors. If the error occurs the stack trace is really huge (several hundred lines long) but it all happens inside the engine, so I can't really do anything about it. Now

What is the difference between STATUS_STACK_BUFFER_OVERRUN and STATUS_STACK_OVERFLOW?

筅森魡賤 提交于 2019-12-21 12:12:32
问题 I just found out that there is a STATUS_STACK_BUFFER_OVERRUN and a STATUS_STACK_OVERFLOW. What's the difference between those 2? I just found Stack overflow (stack exhaustion) not the same as stack buffer overflow but either it doesn't explain it or I don't understand it. Can you help me out? Regards Tobias 回答1: Consider the following stack which grows downward in memory: +----------------+ | some data | | +----------------+ | growth of stack | 20-byte string | V +----------------+ limit of

What is and how to fix System.TypeInitializationException error?

送分小仙女□ 提交于 2019-12-21 07:02:22
问题 private static void Main(string[] args) { string str = null; Logger.InitUserLogWithRotation(); // <--- error occur ... } When I build project, it has no error. But When I execute it, it always aborted. I tried to debug project , but System.TypeInitializationException error occurred at first line. I've already tried to googling , yet found no solution. It seems like any variable initialize code is wrong , but can't find it. Please help me. I'm new to C#. Thanks. ※ Here is Logger Class Code

Why does calling this function with more than 2 parameters in Actionscript 3 cause stack overflow?

做~自己de王妃 提交于 2019-12-21 05:30:13
问题 function testFunc(val1:int, val2:int, val3:int):int { var returnVal:int = 0; return returnVal; } var val:int = testFunc(1, 2, 3); causes locals: Main int int int * 4:dup VerifyError: Error #1023: Stack overflow occurred. 回答1: This page discusses a similar stack overflow issue. It seems adding a trace somewhere in the function will fix it. It's a known bug 回答2: Thank you for pointing this fact out. Anyways here is what I realize. A function in AS3 is defined as function apply(thisArg:*,

How does one implement a “stackless” interpreted language?

梦想的初衷 提交于 2019-12-20 08:39:23
问题 I am making my own Lisp-like interpreted language, and I want to do tail call optimization. I want to free my interpreter from the C stack so I can manage my own jumps from function to function and my own stack magic to achieve TCO. (I really don't mean stackless per se, just the fact that calls don't add frames to the C stack. I would like to use a stack of my own that does not grow with tail calls). Like Stackless Python, and unlike Ruby or... standard Python I guess. But, as my language is

Stack Overflow in IE with JQuery (at line 12/1076)

Deadly 提交于 2019-12-20 07:26:37
问题 I'm using JQuery from Google CDN and I've been getting stack overflow error (using IE8) at lines 12 (for the min file) and 1076 (for the uncompressed one). The JQuery code at the line where stack overflow error takes me to is: JQuery.js ... makeArray: function( array ) { var ret = []; if( array != null ){ var i = array.length; // The window, strings (and functions) also have 'length' // @ALL : this is the line i am getting error on ... if( i == null || typeof array === "string" || jQuery

What kind of Exceptions cannot be handled? [duplicate]

扶醉桌前 提交于 2019-12-20 04:38:33
问题 This question already has answers here : Closed 7 years ago . Possible Duplicate: List of exceptions that CAN'T be caught in .NET As is documented, try/catch blocks can't handle StackOverflowException and OutOfMemoryException. Are there any other Exceptions that also suffer from this limitation? 回答1: Jeffrey Richter made several good points on this topic in his book CLR via C#, part "Trading Reliability for Productivity". BTW, you can catch and handle OutOfMemmory: For some reason that I can

stackoverflow error when creating object outside the main method

两盒软妹~` 提交于 2019-12-20 02:43:10
问题 While running this code it shows Stackoverflow error. What is it I am doing wrong, why does the code compile? public class Foo { int a = 5; Foo f = new Foo(); void go() { System.out.println(f.a); } public static void main(String[] args) { Foo f2 = new Foo(); f2.go(); } } 回答1: You can call go method with an instance only. so before call to go started, c'tor has run for class Foo Now, C'tor is designed to initialize all instance members. So one by one it initializes: a is initialized to 5 f is