stack-overflow

List<element> initialization fires “Process is terminated due to StackOverflowException”

China☆狼群 提交于 2019-12-08 03:08:28
I have structs like below and when I do that initialization: ArrayList nodesMatrix = null; List<vertex> vertexMatrix = null; List<bool> odwiedzone = null; List<element> priorityQueue = null; vertexMatrix = new List<vertex>(nodesNr + 1); nodesMatrix = new ArrayList(nodesNr + 1); odwiedzone = new List<bool>(nodesNr + 1); priorityQueue = new List<element>(); arr.NodesMatrix = nodesMatrix; arr.VertexMatrix = vertexMatrix; arr.Odwiedzone = odwiedzone; arr.PriorityQueue = priorityQueue; //only here i have exception debuger fires Process is terminated due to StackOverflowException :/ Some idea why

Why this Linq code always throws System.StackOverflowException?

雨燕双飞 提交于 2019-12-08 01:08:21
问题 //A query to a local object var deletionCommands = commands .Where(a => a.Operation != Operation.Addition) .Select(a => new { a.Prestador.cod_prestador, a.Prestador.cod_desdobramento }) ; //A Linq-To-SQL query var toDelete = db.Prestadors .Where(a => deletionCommands.Contains(new { a.cod_prestador, a.cod_desdobramento })) ; db.Prestadors.DeleteAllOnSubmit(toDelete); db.SubmitChanges(); The only thing that solved the problem was an explicit loop: foreach (var command in commands) { if(command

Increase stack size in c++

删除回忆录丶 提交于 2019-12-08 00:27:28
问题 I had asked this question couple days ago but It did not solve my problem. I cannot increase stack size in Visual Studio, I am using recursive method which gets high input and it causes to stack overflow. I cannot use vector or something else. What I need is to increase stack size in c++, Visual Studio. P.S. I increased stack reserve size from Visual Studio configuration, however, it does not also solve my problem. void sorting:: MergeSort(int *theArray, int n) { mergesort(theArray, 0, n - 1)

Execution of function pointer to Shellcode

此生再无相见时 提交于 2019-12-07 23:27:32
问题 I'm trying to execute this simple opcode for exit(0) call by overwriting the return address of main. The problem is I'm getting segmentation fault. #include <stdio.h> char shellcode[]= "/0xbb/0x14/0x00/0x00/0x00" "/0xb8/0x01/0x00/0x00/0x00" "/0xcd/0x80"; void main() { int *ret; ret = (int *)&ret + 2; // +2 to get to the return address on the stack (*ret) = (int)shellcode; } Execution result in Segmentation error. [user1@fedo BOF]$ gcc -o ExitShellCode ExitShellCode.c [user1@fedo BOF]$ .

StackOverflowError when i serialize an object

痴心易碎 提交于 2019-12-07 19:41:14
问题 I want to seriliaze an object with this method : public void serializ(CRDT m) throws IOException { ByteArrayOutputStream byteOutput = new ByteArrayOutputStream(); ObjectOutputStream stream = new ObjectOutputStream(byteOutput); stream.writeObject(m); sumMemory = byteOutput.size(); stream.flush(); stream.close(); byteOutput.flush(); byteOutput.close(); } I have an exception java.lang.StackOverflowError Exception in thread "main" java.lang.StackOverflowError at java.io.ObjectOutputStream

Overriding equals/hashCode on cross referencing classes in Java causes StackOverflowError

两盒软妹~` 提交于 2019-12-07 17:18:56
问题 I have two classes that represent two different database entities. Their relationship is 1:m in db and it is represented in class structures something like this: public class Company { private List<Employee> employees; public List<Employee> getEmployees() { return employees; } public void setEmployees(List<Employee> employees) { this.employees = employees; } } public class Employee { private Company company; public Company getCompany() { return company; } public void setCompany(Company

Are programs in functional languages more likely to have stack overflows?

我怕爱的太早我们不能终老 提交于 2019-12-07 07:41:49
问题 I am starting to learn ocaml, and am really appreciating the power of recursion in the language. However, one thing that I am worried about is stack overflows. If ocaml uses the stack for function calls, won't it eventually overflow the stack? For example, if I have the following function: let rec sum x = if x > 1 then f(x - 1) + x else x;; it must eventually cause a stack-overflow. If I was to do the equivalent thing in c++ (using recursion), I know that it would overflow. So my question is,

Application throws java.lang.StackOverflowError Exception in Activity

元气小坏坏 提交于 2019-12-07 06:46:33
问题 I am working on one Android application. in my one activity i am using PullToRefreshListView. sometime i am getting java.lang.StackOverflowError Exception on my activity. i have tried to fix it and i also searched on google too but not getting perfect solution. i have two activity with same functionality with PullToRefreshListView with same data. but i am getting this Exception on only one activity. other activity is working fine. Here is my full StakeTrace. Please help me. Sorry for my poor

Do stack overflow errors occur in Haskell?

…衆ロ難τιáo~ 提交于 2019-12-07 05:30:22
问题 As a pure functional programming language, Haskell intensively uses recursion. Do stack overflow errors occur in Haskell, like in Java? Why, or why not? 回答1: Haskell uses the stack differently from Java, due to laziness. In Java, a stack frame is created when a method is called, and freed when the method returns. So if f() is a recursive method, each recursive call to f() generates a stack frame, and these frames are strictly nested. You can get a stack overflow when you have a deep chain of

Implementing Binary Tree in Ruby

徘徊边缘 提交于 2019-12-07 04:37:43
问题 I've been trying to implement BinaryTree class in Ruby, but I'm getting the stack level too deep error, although I don't seem to be using any recursion in that particular piece of code: 1. class BinaryTree 2. include Enumerable 3. 4. attr_accessor :value 5. 6. def initialize( value = nil ) 7. @value = value 8. @left = BinaryTree.new # stack level too deep here 9. @right = BinaryTree.new # and here 10. end 11. 12. def empty? 13. ( self.value == nil ) ? true : false 14. end 15. 16. def <<(