stack-overflow

What is the stack limit when MATLAB calls function in DLL

ε祈祈猫儿з 提交于 2019-12-10 18:05:57
问题 I am trying to figure out, what is the stack size limitation, when MATLAB calls function in DLL. Is there a way to configure the limit? I am using loadlibrary , and calllib functions to call function implemented in C (in Dynamic-link library). I created a test to figure out the stack limit. I am using MATLAB 2016a (64 bits), and Visual Studio 2010 for building the DLL. Here is my MATLAB source code: loadlibrary('MyDll','MyDll.h') size_in_bytes = 1000000; res = calllib('MyDll', 'Test', size_in

How can I get this function to be tail-recursive?

被刻印的时光 ゝ 提交于 2019-12-10 17:43:04
问题 I'm still trying to implement 2-3 finger trees and I made good progress (repository). While doing some benchmarks I found out that my quite basic toList results in a StackOverflowException when the tree ist quite large. At first I saw an easy fix and made it tail-recursive. Unfortunately, it turned out that toList wasn't the culprit but viewr was: /// Return both the right-most element and the remaining tree (lazily). let rec viewr<'a> : FingerTree<'a> -> View<'a> = function | Empty -> Nil |

Does the C standard define a stack overflow behavior?

こ雲淡風輕ζ 提交于 2019-12-10 17:22:20
问题 Is there a defined behavior for handling a stack overflow? Apart from terminating the process, it doesn't seem like there's a whole lot that can be done. I'm just wondering if anyone might know what the C standard has to say about it. 回答1: The standard does not require the use of a stack, and has nothing to say about stack overflows. 回答2: The C99 standard doesn't define a stack; it only discusses automatic or allocated storage in the abstract, whereas a contiguous stack with overflow

Stack overflow with large fixed size array in Rust 0.13

淺唱寂寞╮ 提交于 2019-12-10 17:16:27
问题 I wish to verify with the Rust expert this simple Rust program (rustc 0.13.0-nightly on Linux x86-64 system): /* the runtime error is: task '<main>' has overflowed its stack Illegal instruction (core dumped) */ fn main() { let l = [0u, ..1_000_000u]; } The compile process ends perfectly with no error but at runtime the program failed with the error shown in the code comment. Is there a limit to the dimension of fixed size array in Rust or is this a bug somewhere in the compiler? 回答1: Rust has

Evaluating if a stack overflow error is possible in a tree traversal recursive algorithm (Java)

送分小仙女□ 提交于 2019-12-10 17:13:31
问题 What is the best way to determine theoretically (i.e., without actually executing it) the circumstances in which a certain tree traversal recursive algorithm will produce a stack overflow in Java? In order to clarify my question, consider the following example. Given a simple binary tree implemented in Java: public class Node { private int value; private Node left; private Node right; ... //in-order traversal public void inOrder() { if (left != null) { left.inOrder(); } System.out.println

C# cannot catch StackOverflowException or see where it happened [duplicate]

限于喜欢 提交于 2019-12-10 16:21:51
问题 This question already has answers here : C# catch a stack overflow exception (9 answers) Closed 6 years ago . I know this is very vague but this is all I could gather. I hope someone has an insight on how this may be happening. I have a 64bit program I'm running on Win 7 64bit machine, built in Visual Studio 2012. It uses a class that is situated in another project (compiled as dll). That class has a buggy iterator that can cause a stack overflow. The operation that calls that buggy iterator

Stackoverflow with specialized Hashtbl (via Hashtbl.make)

南楼画角 提交于 2019-12-10 15:39:03
问题 I am using this piece of code and a stackoverflow will be triggered, if I use Extlib's Hashtbl the error does not occur. Any hints to use specialized Hashtbl without stackoverflow? module ColorIdxHash = Hashtbl.Make( struct type t = Img_types.rgb_t let equal = (==) let hash = Hashtbl.hash end ) (* .. *) let (ctable: int ColorIdxHash.t) = ColorIdxHash.create 256 in for x = 0 to width -1 do for y = 0 to height -1 do let c = Img.get img x y in let rgb = Color.rgb_of_color c in if not

Stack overflow with large array but not with equally large vector?

落爺英雄遲暮 提交于 2019-12-10 15:27:20
问题 I ran into a funny issue today working with large data structures. I initially was using a vector to store upwards of 1000000 ints but later decided I didn't actually need the dynamic functionality of the vector (I was reserving 1000000 spots as soon as it was declared anyway) and it would be beneficial to, instead, be able to add values any place in the data structure. So I switched it to an array and BAM stack overflow. I'm guessing this is because declaring the size of the array at compile

Exception in thread “main” java.lang.StackOverflowError

醉酒当歌 提交于 2019-12-10 14:56:46
问题 I have a piece of code and I could not figure out why it is giving me Exception in thread "main" java.lang.StackOverflowError. This is the question: Given a positive integer n, prints out the sum of the lengths of the Syracuse sequence starting in the range of 1 to n inclusive. So, for example, the call: lengths(3) will return the the combined length of the sequences: 1 2 1 3 10 5 16 8 4 2 1 which is the value: 11. lengths must throw an IllegalArgumentException if its input value is less than

StackOverflowException in XML to C# class

点点圈 提交于 2019-12-10 14:04:19
问题 I am trying to make a class in C# on the basis of the following XML code: <?xml version="1.0" encoding="ISO-8859-1"?> <Catalog> <Book> <Title><TitleA>ORK</TitleA></Title> <Author>J.D. Salinger</Author> <Publisher>Little Brown and Company</Publisher> <Pub_Date>1951</Pub_Date> </Book> <Book> <Title><TitleA>NAA</TitleA></Title> <Author>Jan</Author> <Publisher>Jans forlag</Publisher> <Pub_Date>2011</Pub_Date> </Book> </Catalog> I have looked on this thread XML to c# Question, but I have not been