4,257 questions
0
votes
1
answer
105
views
How much stack space is required for saving the function context in Go 1.24?
How much stack space is required for saving the function context in Go 1.24?
I wrote an go demo like this:
func getStackUsage() {
var recurse func(int)
recurse = func(n int) {
tmp := n
...
1
vote
1
answer
31
views
Why eta-reduced of genericShow-based show definition overflows stack for recursive types
Consider the following recursive data type:
data Chain a = End | Link a (Chain a)
By deriving a Generic instance for this recursive type, show can be defined in terms of genericShow:
derive instance ...
0
votes
0
answers
93
views
Does a local constexpr variable occupy the stack space? [duplicate]
constexpr int f(int idx) {
constexpr auto arr = std::array<int, 1'000'000'000>{}; // stack overflow?
return arr[idx];
}
int main() {
return f(1024);
}
Does arr occupy the stack ...
0
votes
0
answers
51
views
Is there a way to make a suspension type that is stack safe in a strict language?
Suppose I were trying to build lazy datastructures in a lazy language (Im currently using Typescript, but the specific language matters little).
The obvious implementation is
class Lazy<T> {
...
0
votes
1
answer
141
views
Why is my vector<uint8_t>[4096] being treated like a pointer and causing a stack overflow? [closed]
I'm trying to create a simple Memory class in C++ which simulates 4096 bytes of memory using a vector<uint8_t> array. I wrote an addToMemory function that copies the contents of a vector<...
-4
votes
2
answers
211
views
Why does my recursive pow(x, n) implementation cause a stack overflow for large n? [duplicate]
I'm trying to implement a recursive power function in C++, but it fails with large n due to stack overflow. Here's the code:
class Solution {
public:
double myPow(double x, int n) {
long ...
1
vote
1
answer
170
views
Unsolvable Stack Overflow Error in Java Spring Boot
I have this issue where, upon sending ANY request from my frontend web app (Next.js) to my backend application in Spring Boot, I get a Stack Overflow Error, and not only that, but my application ...
17
votes
2
answers
2k
views
Is it safe to catch stack overflows? Can it leave objects in messy/intermediate states?
I've been reviewing ways to kill threads in Java, and the overwhelming conclusion is that it is never safe to stop code at arbitrary points - doing so may leave resources in messy intermediate states. ...
4
votes
1
answer
73
views
If one thread uses a lot of stack frames, could that cause stack overflow on an "innocent" thread?
For context, I have a situation where less-than-trusted user code needs to run on a shared system. The code is subject to various static analysis passes and quality assurances, and some ways it can ...
1
vote
2
answers
133
views
Multidimensional array stack overflow in Delphi 11.3
Suddenly we faced the following problem that the allocation of the multidimensional array consumes more memory than it is required for the array itself.
Minimal code to reproduce:
type
TConfig1 = ...
19
votes
1
answer
151
views
How to implement a destructor for an n-ary graph node that won't cause a stack overflow?
I'm working on modernizing an older C++ code base that contains a simple graph structure. It originally looked like the following:
struct node_value_t {
...
};
struct dag_node {
std::vector<...
0
votes
1
answer
49
views
What is the appropriate value of the jvm -Xss parameter?
How does the -Xss play a key role in java program?
The size of the stack directly affects the program running.
As I know -Xss decides the thread stack size of jvm, includ local variables, operand ...
0
votes
1
answer
43
views
Assistance With Understanding Stack Over Flow Errors (Julia - GLMakie Package)
Below is my code:
using GLMakie
#Creation of constants
a = 2
b = 5
c = 7
d = 9
# Creaiton of observables
RadTheta2_2 = Observable(.523)
RadTheta3_12 = Observable(-1.288)
RadTheta4_12 = Observable(-2....
1
vote
1
answer
62
views
A lambda continuation with a generic type does not produce a stack overflow, but when I specify the type it results in a stack overflow. Why?
In a program I'm writing, I'm faced with a recursive type that I want to go through recursively (it seems necessary). Out of curiosity, I wanted to try and write a tail recursive version of my code, ...
0
votes
1
answer
56
views
Stack Overflow on Quicksort with a first element pivot in Java
For this assignment I'm supposed to test my quicksort class using a variety of different pivots and a variety of ArrayLists in different arrangements. The class works fine with a random pivot, or a ...