Questions tagged [heap-memory]
The heap is process memory set aside for dynamic allocation.
6,250
questions
0
votes
0
answers
12
views
v8 getHeapShot causes jest to hang indefinitetly
Currently, I have a memory leak in my code and I'm trying to debug it by creating a heap snapshot using Nodes v8 library. I'm creating an endpoint in typescript using express which I can call and it ...
4
votes
2
answers
43
views
Unable to correctly allocate memory and failing to free it in my (ft_split) function
I am trying to create a ft_split function which should:
Allocates with malloc and returns an array of strings obtained by splitting ’s’ using the character ’c’
as a delimiter. The array must end with ...
0
votes
0
answers
16
views
Memory usage of a thread in QNX using CPP - Stack, Heap, and data segment
We've QNX 7.1.0 and our application is written in CPP. We need to find out stack, heap and data segment memory usage of the current thread which is running . Is there any API or QNX command to find it?...
0
votes
0
answers
21
views
How to visualize self referential structures?
struct node {
int data;
int key;
struct node *ptr;
}
I am quite new to programming.
Please help me imagine how the memory is created in self referential structures.
Why can I not use another ...
0
votes
1
answer
49
views
How do you keep track of all strings allocated in Forth and free them on time?
I see a lot of Forth code just doing s" Hello " s" world" s+ like it's nothing, but now that I think about it, this actually allocates 3 pointers, and lose two of them to the great ...
-3
votes
0
answers
25
views
Vue 3 limit DOM nodes and event listeners growth [closed]
Im using vite, vue3 and tailwindcss. In my project when, for example, I switch views or toggle modals the performance monitor shows an increase in the number DOM nodes and JS event listeners. ...
0
votes
1
answer
36
views
heap memory overflow master nodes (continuous GC) - Elastic Search
Recently, encountered increases in the heap memory usage in the master nodes (heap memory overflow master nodes continuous garbage collection ). I try to debug the root cause using the heap dump saved ...
0
votes
0
answers
20
views
Why Linux process has two heap segments?
I am reading Linux proc manual: https://man7.org/linux/man-pages/man5/proc.5.html and found there are two [heap] segments in /proc/[pid]/maps description (see below). Actually, I occasionally saw two [...
0
votes
1
answer
46
views
(C++) What happens to heap objects created inside an if statement after the statement is over? [duplicate]
as the title suggests I was wondering about the availability of the heap objects I create inside if statements/for loops/any other functions, after the closing bracket is called. As a minimalistic ...
1
vote
1
answer
63
views
Why do I have to malloc the buffer each time I call 'getline' on a new file pointer?
I have a daemon written in C that reads a file every INTERVAL seconds line by line and does some work on each line if it matches the criteria. I can't leave the file open since the file is being ...
1
vote
1
answer
87
views
How can Python guarantee memory safety?
I'm learning Rust, and there, they reason that the following (python-equivalent) code is unsafe:
vec = ['1', '2']
ref = vec[0]
vec.append('3')
The rationale is ref is a pointer to element in vec, ...
0
votes
0
answers
36
views
Fix closure allocations in enumerable lambdas in c#
I have DPA plugin in Rider and it shows me some closure allocations in lambdas.
I know what closure is and why there is. I know why c_DisplayClassxx is created.
But my question is - how to change code ...
0
votes
1
answer
55
views
Creating object on stack, from a class with dynamic members
Assume we create an object on stack as
class Test{
Test(int i) {i_=i;}
Test(std::vector<int> v) {v_=v;}
int i_;
std::vector<int> v_;
};
int main() {
Test a;
// how much memory is ...
0
votes
1
answer
39
views
Why are user processes responsible for requesting memory from the OS?
Heap allocators are responsible for actively requesting memory from the OS to grow the heap, e.g., with brk or mmap. Accessing unallocated memory leads to segfaults.
I could design a different OS-user ...
1
vote
0
answers
26
views
Why does Tomcat consume so much more memory than the heap (and why does doing a heap dump reduce tomcat process memory so much)? [duplicate]
We have a Java 11 app running in Tomcat 9.0.37 on an older Windows 2012 Server based Ec2 instance in AWS. The application is very memory intensive and receives a lot of traffic. The max heap is set to ...
0
votes
1
answer
20
views
significance of different hex address with call stack trace
what is the significance of all these different hexadecimal address (in bold) ? how to get exact problematic line number of source code for dumped function below from this hex address of crash dump ...
0
votes
1
answer
71
views
"A breakpoint instruction (__debugbreak() statement or a similar call) was executed in Main.exe", but there is no error?
I have an infinite loop that breaks if user exits out of the main window. I have the following code running in the loop:
unsigned int* renderableShapeIndices = new unsigned int[aNumberCreatedAtRuntime]...
-1
votes
0
answers
24
views
Gastby - hosting preview server on Heroku - FATAL ERROR: Reached heap limit Allocation failed
Goal
I am trying to host my development version of a gastby website on Heroku.
So I can use it as a preview server for graphCMS.
The issue
I keep receiving the following error:
<--- JS stacktrace --...
-5
votes
0
answers
83
views
Is declaring something over 1 million bytes expensive in c++/c [duplicate]
I am aware that I can use vectors or arrays for 1 million bytes but to confuse crackers with decompilers Im thinking of declaring a million byte variables in cpp. This is supposed to separate out ...
0
votes
2
answers
64
views
Is Dynamically allocated memory global?
I am wondering if dynamically allocated memory with malloc global? I am reading online that allocated memory with malloc is stored on the heap. I also read online that all global variables are stored ...
-2
votes
0
answers
28
views
String pool in Java,Calculation of expressions with the literats at the compilation stage? [duplicate]
Guys, why in one case the expression (string str2 = "top" + "java";) with string literaals (second -class) is calculated at the compilation stage,
And in the second case (string ...
3
votes
3
answers
87
views
How is the size of a polymorphic object deduced in a delete operation?
I know that there are a lot of similar questions on SO related to what I am about to ask, I've read many of them and still feel a bit vague, so I decided to ask this question.
Given the following code:...
1
vote
1
answer
64
views
java startup option "-Xmx512M -XX:MaxPerSize=1024M" doesn't work for my jvm
I'm using oracle jdk1.8 on win10, trying to set max heap size of JVM and see what happens when OOM. Using this code snippet:
package mygroup;
import java.util.ArrayList;
import java.util.List;
public ...
1
vote
0
answers
34
views
what will happened if I don't protect malloc?
char *str = malloc(1000); // that is ok
// do somthing ...
free(str);
//but what if i didn't protect malloc from failure
// i mean doing that
char *str = malloc(1000);
if (!str)
return (0);
//...
2
votes
1
answer
79
views
Why is JVM -Xms option not simply 0?
Why does the JVM have an -Xms option? Why do we care about a minimum heap size? Why not just 0? It's super easy to allocate RAM, so I don't see the point of forcing a minimum heap size.
In my ...
0
votes
0
answers
27
views
nestjs start heap memory error on aws lightsail
I'm running nestjs on lightsail.(dev)
An error occurred in the yarn.lock file during operation, so I deleted the file and entered the yarn install command.
After that, the following message occurs.
&...
0
votes
0
answers
15
views
Best way to assess real memory usage of a C++ program?
I am experimenting with multiple ways of fetching data from DB in my C++ program. I create a local std::vector of struct type from the data. My program doesn't access most of the fetched data. I am ...
0
votes
0
answers
56
views
why doesn't freeing the pointer that valgrinds says leaks memory, work
I'm writing a simple version of shell and everything works fine except when an executable is not found there is a memory leak.
Valgrind says the leak comes from the function exe_find, from which I ...
0
votes
0
answers
21
views
How to measure heap memory in Web Worker - JavaScript?
So, I am using dedicated worker scope i.e. DedicatedWorkerGlobalScope to access performance object to access memory but I don't see any attribute there using performance object.
[WorkerGlobalScope....
0
votes
1
answer
23
views
Can threads share their stacks? Or are they completely parallel to each other?
One thread has to be created within an operation in another thread, does that mean that one thread exists within another thread's stack? Or are they completely parallel once initialized?
Or is this ...
2
votes
2
answers
82
views
In C++, is it beneficial if each thread allocates the memory that it will later (in a different parallel region) write to?
void reserve1(vector<vector<int>>& vec, size_t siz) {
for (auto& v : vec) {
v.reserve(siz);
}
}
void reserve2(vector<vector<int>>& vec, size_t siz) {
#...
0
votes
1
answer
44
views
How to increase heap memory size for Spock Framework?
The Java program runs fine but the test fails with the message:
Caused by: java.lang.OutOfMemoryError: Java heap space
at java.base/java.util.BitSet.initWords(BitSet.java:167)
at java.base/...
0
votes
2
answers
78
views
Out of Memory Heap Space
I am working on a code that will output all the possible combinations of a certain amount of objects that will occur between three possibilities. My code is working for smaller numbers like 10,000 but ...
0
votes
1
answer
69
views
How do I suppose to delete dynamic object which is may be allocated in an slot method?
Either one of method the slot/method will allocate memory on heap then how do I suppose to delete it in the destructor?
Test::~Test()
{
delete frame;
delete frame_2;
delete ui;
}
void ...
10
votes
1
answer
372
views
Why is MemoryPool slower and allocates more than ArrayPool?
I'm not entirely sure if I have done something wrong in my tests, but from my results MemoryPool is consistently slower and allocates more memory than ArrayPool, since you can convert Array type to ...
0
votes
0
answers
62
views
discord.js - FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
When trying to make a help menu for my discord bot everything kind of broke and I keep getting this error.
FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap ...
0
votes
0
answers
31
views
Apache Spark driver memory misunderstood usage
in a AWS Glue job, the heap memory usage of the driver is going wild and I'm unsure what's going on.
I've got mainly two phases: joins (of parquet-saved tables) and post-elaboration, where most of the ...
0
votes
2
answers
37
views
How does free() interact with a struct made on the stack that contains an array made on the heap?
Say I want to create a new struct that contains image data
struct Image {
int *pxl_arr;
int pxl_arr_len;
int img_wdt, img_hgt;
};
And I also had a separate function that opened an image ...
0
votes
1
answer
81
views
JPA batch update: do I have to flush() and clear() entity manager before last transaction commit()?
I am updating large number of rows in Oracle database. For that reason, I am doing batch update. My code seems to be working fine. I just realized that, I do not flush() or clear() entity manager ...
1
vote
2
answers
49
views
Why do I get the error: "double free or corruption(out) core dumped Aborted core dumped", when trying to free memory on heap?
I have used a malloc 2-D array and this it:
charArray = (char **)malloc(rows * sizeof(char *));
for (i = 0; i < columns; i++)
charArray[i] = (char *)malloc(columns * sizeof(char *));
And when ...
0
votes
1
answer
54
views
Difference between uniform initialization vs new operator
Let's assume that I have the following class:
Class Foo {
public:
int j;
Foo(int i){
j = i;
std::cout << j << endl;
};
}
I am new to C++ and I'm confused about ...
0
votes
0
answers
81
views
Gitlab CI getting java heap size error while building
I am running a pretty classic project having a lot submodules within on Gitlab CI for building. On one of the module it throws error:
Failed to execute goal org.apache.maven.plugins:maven-war-plugin:3....
17
votes
4
answers
1k
views
How come std::initializer_list is allowed to not specify size AND be stack allocated at the same time?
I understand from here that std::initializer_list doesn't need to allocate heap memory. Which is very strange to me since you can take in an std::initializer_list object without specifying the size ...
1
vote
1
answer
102
views
Why is Box called like that in Rust?
Box<> is explained like this on the Rust Book:
... allow you to store data on the heap rather than the stack. What remains on the stack is the pointer to the heap data.
With a description like ...
0
votes
1
answer
71
views
why is my setenv implementation not permanently setting the environment variable
I have been tasked to write an implementation of the library function setenv().
This is what I came up with:
create an array of strings on the heap with the number of words in the environment path ...
0
votes
1
answer
79
views
Spark goes java heap space out of memory with a small collect
I've got a problem with Spark, its driver and an OoM issue.
Currently I have a dataframe which is being built with several, joined sources (actually different tables in parquet format), and there are ...
0
votes
2
answers
58
views
Searching and editing values in the heap of the current process in C
So in our university assignment we were asked to change the output of two sequential printf("%s", s1); printf("%s", s2); functions without touching the variables. The intent was ...
1
vote
0
answers
34
views
What is the amount of stack memory allocated for execution by the Swift Compiler?
I want to know the amount of stack memory allocated for execution by the Swift Compiler. Is it dependent on the native machine's RAM ? If yes, then how is heap memory allocated ?
0
votes
0
answers
43
views
large memory consumption with Hibernate sql statement
I,m having problems consuming heap memory, analyzing a dump i found that a large number of char [] are instantiated.
these arrays contain sql statements and are referenced by hibernate classes.
heap ...
-1
votes
2
answers
80
views
Dynamic Memory for Char pointer Array
I'm still very new to C++, and I'm having issues with allocating heap memory.
This is what I have in my header file:
const int NUM_WORDS = 1253;
const int CHAR_SIZE = 256;
class CWords
{
public:
...