6,672 questions
6
votes
1
answer
234
views
Java Map.computeIfAbsent consuming high memory [duplicate]
I had written a method to update a HashMap, provided an int id value (ex: client id) as key, the method would check if the key is available in the map, if not it would create an entry and associate a ...
3
votes
1
answer
189
views
Memory Layout of C Programs: How is size of stack-heap space determinded?
I was reading an article on the Memory Layout of C Programs; https://www.geeksforgeeks.org/c/memory-layout-of-c-program/.
It mentioned, under "4. Stack Segment":
When the stack and heap ...
0
votes
2
answers
172
views
What is the difference between the Heap size and the Private Bytes size?
I have a .Net 4.7 application (WPF) whose memory consumption increases to 5.785 GB in private bytes, but the heap bytes are 4.260 GB, as shown in the figure taken by Process-Explorer:
If I run GC ...
0
votes
0
answers
45
views
NextJs project is causing FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory
My nextjs 15 project is causing FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory.
Error details is as follows
2025-09-21T18:50:49: [905257:0x25f7a690] 48491672 ms: ...
2
votes
3
answers
278
views
How to detect whether a variable is allocated on the stack or the heap in C?
I’m working on a C project where I need to know if a pointer refers to memory allocated on the stack or the heap.
For example:
int x = 42; // stack variable
int *y = malloc(sizeof(...
0
votes
1
answer
49
views
How does a microcontroller keep track of heap free()?
In a microcontroller without any OS, how does the microcontroller keep track of where a malloc will point to in the heap?
char *x;
char *y;
char *z;
x=(char*)malloc(10);
y=(char*)malloc(10);
free(x);
...
1
vote
1
answer
185
views
How does C prevent heap growing indefinitely?
I’m investigating how C’s runtime memory allocator behaves in a long-running process that repeatedly:
allocates many blocks of variable size with malloc(),
finishes its work, and
calls free() on all ...
0
votes
1
answer
113
views
Is there a way to obtain an accurate description of the heap state?
I was fascinated by this video on visualization of Haskell heap, but unfortunately I haven't been able to use ghc-vis. My understanding is that it is too old now. (Feel free to suggest how to actually ...
0
votes
1
answer
105
views
Spring boot multi-module gradle project - integration tests throwing java.lang.outOfMemory error
I have a big Spring Boot aplication composed of multiple micro services using Gradle buildSrc. It contains a lot of tests seperated into seperate tasks (unit, integration, acceptance...).
These tests ...
1
vote
0
answers
102
views
Static DRAM Usage
I’ve read in the ESP32 documentation that:
There is 520 KB of available SRAM (320 KB of DRAM and 200 KB of IRAM) on the ESP32. However, due to a technical limitation, the maximum statically allocated ...
-1
votes
1
answer
154
views
Heap Corruption happening while delete[] for partially allocated array
I had a heap corruption error recently which I solved but cannot understand what is happening
I am allocating memory for a DBL array,
new DBL[length+1]; // where length = 1000;
Later I am writing ...
-1
votes
1
answer
142
views
Why is there a heap-after-use error here? I am trying to solve a Leetcode problem in C++. I don't see any dangling pointers or refs to freed memory
I am trying to solve LeetCode 2487: Remove Nodes From Linked List, and I’ve implemented a solution in C++ that first reverses the list, then removes nodes that have a greater value node to their left (...
0
votes
0
answers
107
views
Why does an in-scope object show as "dead" in Visual Studio when doing a heap snapshot?
I have this sample program:
Program.cs:
internal class Program
{
private static void Main(string[] args)
{
var testObject = new ZZTest();
Console.ReadLine();
Console....
1
vote
0
answers
97
views
How does Python represent slices in various cases?
Consider
l = [1, 2, 3, 4, 5]
print(l is l[:])
t = (1, 2, 3, 4, 5)
print(t is t[:])
print(t[1:] is t[1:])
print('aa'[1:] is 'aa'[1:])
print('aaa'[1:] is 'aaa'[1:])
The result is, somewhat surprisingly,...
0
votes
0
answers
59
views
Java stream row not getting cleared from heap space
OutOfMemoryError while streaming 20M+ rows in Spring Boot with Hibernate
Issue
I’m streaming 20M+ rows from my Content table using a Stream<Object[]> in Spring Boot with Hibernate. However, I ...
-5
votes
1
answer
85
views
How to release the large object memory which is occupied by xdocument immediately? [duplicate]
XDocument xDoc1 = XDocument.Load(XMLFilepath1, LoadOptions.PreserveWhitespace);
Please suggect any options other GC.Collect() for clearing large objects immediately. We tried below options-
GC....
0
votes
1
answer
61
views
windbg heap memory mismatch vs total memory of individual addresses
I'm m debugging a .Net process for a possible memory leak.
The command !address -summary shows:
0:000> !address -summary
--- Usage Summary ---------------- RgnCount ----------- Total Size -------- ...
-1
votes
1
answer
38
views
Hypersql (HSQL) startup time and heap memory uses
I am using HSQL with java, HSQL database file size is 3 GB then it need 10 GB heap memory and approx. 5-7 minute database boot time while creating datasource.
Need suggestions to bring down heap ...
0
votes
0
answers
122
views
Heap Memory Stair-Case rising in SwiftUI project
A simple keyboard extension app showing continuous heap memory allocation each time open the keyboard on screen.
For easier understanding see the image below...
Here is the KeyboardViewController:
...
0
votes
1
answer
215
views
How is a heap overflow attack implemented?
I am learning about heap overflow attacks, but I am encountering a problem.
Based on the knowledge I found online and my own guesses, I believe that a heap overflow attack involves overwriting ...
-1
votes
1
answer
54
views
How to reduce heap space utilization when working with a list PDF documents?
I have a microservice that generates multiple PDF Documents and saves to database. For generating each document, from the main service class, I call multiple document specific service class methods by ...
1
vote
1
answer
147
views
Is arr in stack or heap?
I want to understand if arr here is in stack or heap. Since obj is dynamically allocated is the arr in heap? What if i do not have obj2, if i just allocate obj dynamically in main?
#include <...
1
vote
1
answer
218
views
Strange garbage collection behaviour leads to server performance degradation
Background to the Application:
We have a Java WebApp on a Tomcat Server for multiple users. We have 30+ customers servers running.
Problem:
On one particular customer we run into a strange phenomenon ...
3
votes
1
answer
84
views
Observing the default process heap getting created (breakpoint on heap creation)
I want to observe when the default process heap gets created, i.e. have a breakpoint and get the callstack of the creation. This has no practical background. I just want to understand the Windows ...
1
vote
0
answers
55
views
Not able to merge free blocks together in my simple, custom, memory allocator
I am trying to implement a simple memory allocator. Essentially trying to copy the function malloc() and free(void *ptr) in C.
I initialize a region of memory using sbrk(). In my custom malloc ...
2
votes
1
answer
188
views
Which option has precendence if I enable and disable FrontEndHeapDebugOptions at the same time?
The undocumented (I can't find a MSDN reference) FrontEndHeapDebugOptions Registry key has two flags:
Bit 2 (0x04) for disabling the Segment Heap, thus forcing NT Heap
Bit 3 (0x08) for enabling the ...
0
votes
0
answers
30
views
Node.js: Application crashing with ‘Heap Out of Memory’ error
What are the best practices and tools for performing a memory profile on a React.js frontend and a Strapi backend application? How can I identify memory leaks, optimize memory usage, and ensure ...
0
votes
2
answers
84
views
I am trying to increase the JavaScript heap memory for my angular application which is causing the app to crash
I am working on an ecommerce application that is multilayered using angular for its frontend. When I serve the application using ng serve the application is served to my local host but later on it ...
0
votes
0
answers
44
views
How to fix every allocation in debugging?
I have an app written in C++ (Windows) which also used some third party libraries. In the app there are many news/deletes together with mallocs and frees. Now I met with a bug that some data on the ...
1
vote
0
answers
221
views
Springboot scheduled application increasing memory in docker
I have a springboot microservice (updated to spring-boot-starter-parent 3.4.0) that is run on a schedule every 5 minutes that checks a database table (oracle jdbc driver 19.20.0.0) for new task ...
0
votes
0
answers
343
views
Pico flash and heap - how much available and how much is used
I am learning how to program a Raspberry PicoW in C++ and I have two question about flash:
How much of the flash is my programme taking up? With AtMega programming, the compiler would display this ...
2
votes
2
answers
84
views
Struct with fields of List type, but set to null: Heap allocation?
Consider a struct like this:
struct ExampleStruct
{
public int ID;
public List<ExampleStruct> children;
}
Would the following line of code create an object on the heap?
ExampleStruct ...
1
vote
1
answer
97
views
Why do this heap pointers print different addresses?
If I'm correct, both printf should show that the variables have the same address, because in the meantime nothing has been allocated to the heap, but it shows different addresses.
#include <stdio.h&...
0
votes
1
answer
89
views
Valgrind Invalid read write for all instance variables of the class
I have a class which have certain instance variables. I am getting random crashes when i run my application. Thinking memory corruption, I ran the application under valgrind, and I am able to narrow ...
48
votes
3
answers
6k
views
An empty program that does nothing in C++ needs a heap of 204 KB, but not in C
Consider this empty program:
int main()
{ return 0; }
If I compile it with C++ with g++ main.cpp && strace ./a.out, and analyze the output with strace, I observed that the last lines of the ...
2
votes
4
answers
488
views
How to make shared pointer from raw pointer and make other shared pointers aware of it?
I have some hierarchy (through composition, not inheritance) of classes: Child and Parent. Child can have multiple parents, also Parent could do the same. I want the Child class lifetime being managed ...
7
votes
1
answer
85
views
How to structure the type of a Rust object to share between threads
I'm writing an application with two threads: a UI thread and compute thread. I want them to share a vector of buffers with type T. Since it's 90% reading, I chose to go with an ArcSwap for ...
0
votes
0
answers
196
views
OutOfMemoryError when resizing large images using Thumbnails in Java (Heap Size Limitation)
I'm encountering a java.lang.OutOfMemoryError when trying to resize large images using the Thumbnailator Dependency in Springboot. My heap size is limited to -Xms256m -Xmx512m, and I believe the issue ...
1
vote
1
answer
118
views
Drools going OutOfMemory after upgrade 6.4.0 to 8.44.2
We're upgrading a Drools Fusion application from 6.4.0 to 8.44.2. The application is managing just 1 single long running KieSession in stream mode (config.setOption(EventProcessingOption.STREAM)). ...
1
vote
4
answers
170
views
Why can the stack collide with the heap if they are located in a virtual space that is very large in size?
If each process has its own address space and it is much larger than the physical memory of the computer, why can’t we just place the stack at the end of this address space and the heap at the ...
1
vote
0
answers
228
views
Angular Memory leak: simple input resulting in detached nodes
I have generated angular app for the test purpose, created Page1 and Page2 components.
Page2Component TypeScript:
import { Component, OnDestroy } from '@angular/core';
@Component({
selector: 'app-...
0
votes
0
answers
100
views
Memory issues in kafka
During Kafka's work, we noticed that the Garbage Collector was freeing up less and less memory.
memory leak
We are using a kafka cluster with three brokers with the following settings:
POD_NAME: ...
3
votes
1
answer
141
views
Understanding the relationship between Max Heap size, Heap size and Used heap
For this application, -Xmx64m is allocated (the same can be seen from the chart from VisualVM). However, it is not clear what exactly these areas mean in the context of memory allocation to this ...
0
votes
1
answer
158
views
Cannot memory-free strings from arbitrary-length array of strings
I want to write a function that will read a text file, and return its lines as an array of strings for further processing.
To this end, I am trying to get my head around correctly handling an N-length ...
0
votes
1
answer
80
views
JMeter: OutOfMemoryError with Large JMX Files
I'm encountering severe issues when attempting to open JMX files larger than 2MB or with large payloads in JMeter. The application becomes unresponsive and utilizes a high amount of CPU. When I do ...
0
votes
1
answer
48
views
/proc/$pid/statm application reports on x86_64 (amd64) 4 times more mapped pages as same application on arm64 (aarch64)
We have a C++ multi-threaded application with shared libraries, running on linux x86_64 (debian-12, kernel 6.1.xx) and on a raspberry pi 5 ( arm64, debian-12, kernel 6.3.xx ). If I lock at /proc/$pid/...
0
votes
1
answer
78
views
Stack and heap size allocation question for common Unix OS
In Unix operating systems how are sizes between low and high address of the following picture chosen? I’m assuming this has something to do with Virtual Memory management and allocation of pages.
I’m ...
0
votes
1
answer
92
views
What's the flexibility in concrete types mentioned by Bjarne Stroustroup?
In Chapter 5.2 of the 3rd edition of A Tour of C++, Bjarne write this about concrete types. What I don't understand is what the flexibility is.
Is he referring to the use of pointers in concrete ...
0
votes
0
answers
74
views
Why .NET Web Api got this behavior on Memory usage?
I created a simple code just to test something is happening with my app on docker. Im just creating 1gb of bytes to test the memory usage on my app dockerized, and what i realized is that the memory ...
1
vote
0
answers
50
views
SpringWebflux Log4j2 Memory Issue
I have a spring boot webflux application which calls 5 different backendservices using webclient. We have Log4j2 for logging and using MDC based logging to hold some log lables and attach it to log ...