stack-overflow

Generating a list causes a stack overflow

不想你离开。 提交于 2019-12-11 06:39:15
问题 I'm generating a list of random numbers: let gen n = let rec pom l n = match n with | 0 -> l | _ -> let el = Random.int 20000000 in pom (el::l) (n-1) in pom [] n let lo = gen 1000000 What I get is Fatal error: exception Stack_overflow Why? I'm using tail recursion (and an accumulator) EDIT : You're right, the stack overflows on both sorts. But if my code had a zillion lines, it would be a pain to debug it this way. I'd like to use ocamldebug here, just as a learning experience. I ran

Stackoverflow error in OnstartPage method

廉价感情. 提交于 2019-12-11 04:02:47
问题 I intend to have a different String for every Start of Page depending on values I read from another File. I have Placed this in my onStartPage Method Like this: @Override public void onStartPage(PdfWriter writer, Document output) { try { File finish = new File("C:/Statements final/"); File[] finf = finish.listFiles(); Font f1 = new Font(Font.NORMAL, 12); f1.setColor(Color.BLACK); String firstline = ""; for (int k = 0; k < filenames1.length; k++) { FileInputStream fs = new FileInputStream("C:

Java overriding hashCode() gets StackOverflowError

故事扮演 提交于 2019-12-11 03:52:13
问题 so I'm not well versed in overriding hashCode and I seem to have some infinite recursion somehow going on with the hashCode method. Here is my scenario, I have a class DuplicateCache that is a cache object that checks for duplicate objects in our system. I have a static inner class Duplicate which represents the Duplicate objects. The DuplicateCache maintains a HashMap to keep track of all its entries. Each entry consists of a Duplicate object as the key and a Long object as the value. I am

JPA. Stackoverflow on cascade merge

删除回忆录丶 提交于 2019-12-11 03:44:19
问题 Here is my JPA structure: Movie (look at cascade types): @Entity @Table(name = "movie") public class Movie { @Id @Column(name = "movie_id") @GeneratedValue(strategy = GenerationType.AUTO) private Integer id; //@OneToMany(cascade = CascadeType.ALL, mappedBy = "primaryKey.movie") //stack overflow @OneToMany(mappedBy = "primaryKey.movie") //works fine private List<Rating> ratings; .... } Rating: @Entity @Table(name = "rating") @AssociationOverrides({@AssociationOverride(name = "primaryKey.movie"

Can JProfiler measure stack depth?

空扰寡人 提交于 2019-12-11 02:58:46
问题 This is closely related to another question: How can I measure thread stack depth? Can JProfiler watch threads and measure where the deepest stacks occur? If so, how can I do that? I'd like find spots in my application where I'm getting dangerously close to triggering a StackOverflowError. 回答1: JProfiler does not have this as a feature directly. However, you can do the following: Record CPU data with sampling and no filters go to the call tree view in the CPU section export the call tree in

How to avoid stackoverflow in clojure recursive function?

不羁的心 提交于 2019-12-11 02:57:10
问题 Here is an example: ;; Helper function for marking multiples of a number as 0 (def mark (fn [[x & xs] k m] (if (= k m) (cons 0 (mark xs 1 m)) (cons x (mark xs (inc k) m)) ))) ;; Sieve of Eratosthenes (defn sieve [x & xs] (if (= x 0) (sieve xs) (cons x (sieve (mark xs 1 x))) )) (take 10 (lazy-seq (sieve (iterate inc 2)))) It produces a StackOverflowError. 回答1: There are a couple of issues here. First, as pointed out in the other answer, your mark and sieve functions don't have terminating

scala.MatchError: java.lang.StackOverflowError (of class java.lang.StackOverflowError)

廉价感情. 提交于 2019-12-11 02:42:32
问题 I had a project that was developed using play scala 2.0 and it was working fine and i had a need to upgrade the version to 2.3.8 . So i migrated my application version by following this link https://www.playframework.com/documentation/2.3.x/Migration23 and i am able to run the code in newer version in my machine where i have 8 GB RAM and jdk 1.7.0_25 but when i run the code from some other machines with 4 GB RAM it throws the following error Even it is breaking in some systems with 8 GB and

Stack Overflow when Pyparsing Ada 2005 Scoped Identifiers using Reference Manual Grammar

依然范特西╮ 提交于 2019-12-11 02:37:20
问题 I'm currently implementing an Ada 2005 parser using Pyparsing and the reference manual grammar rules. We need this in order to analyze and transform parts of our aging Ada-codebase to C/C++. Most things work. However, one little annoying problem remains: The grammar rule name when parsing scoped identifiers (rule selected_component ) such as the expression "Global_Types.Integer2" fails because it is part of a left-associative grammar rule cycle. I believe this rule is incorrectly written: the

How do I solve this StackOverflowError?

二次信任 提交于 2019-12-11 02:35:26
问题 In this section of my MergeSort program, I am recursively dividing a unsorted array called "arr". To do this I create two subarrays, "leftArr" and "rightArr", then I fill "leftArr" and "rightArr" with the first half of "arr" and the second half of "arr" respectively. Afterwards I will use recursion to divde / sort leftArr and rightArr. Just wanted clarify: mid = arr.length; To initialise the rightArr I do the following: double halfLength = arr.length * 0.5; if((!(halfLength < 0)) && (!(0 <

Check if Integer is too great

不打扰是莪最后的温柔 提交于 2019-12-11 02:26:58
问题 I am working on an exchange system and the user is setting the price and amount for an exchange. I want to make sure that the exchange is no greater than the Integer maximum value, but I am running into a problem. When the amount of the exchange is put to 9 or more, even though I have a check to make sure the number is no greater than the maximum value, it does not work. I have done some debugging and when setting the amount to 9 while the price is 2,147,483,646 (1 less than the max number),