Questions tagged [heap-memory]
The heap is process memory set aside for dynamic allocation.
heap-memory
6,649
questions
1
vote
1
answer
41
views
What would prevent java garbage collection from cleaning heap?
Two k8s pods running the same image (using Adoptium 17 JRE).
Around 9pm, they start getting requests and objects are getting created.
On the blue pod, we can see the garbage collection working ...
0
votes
0
answers
28
views
Getting heap storage with proper alignment in C++ for overaligned type
In some use case, you'll need to allocate storage before creating objects inside this storage.
Then in order to create these objects, you may need to use placement new:
T *pobj = new(pstorage);
yet ...
-1
votes
1
answer
50
views
Getting heap storage with proper alignment in C++ for non-overaligned type
In some use case, you'll need to allocate storage before creating objects inside this storage.
Then in order to create these objects, you may need to use placement new:
T *pobj = new(pstorage);
yet ...
0
votes
1
answer
41
views
Twostate predicate cannot prove parameter is allocated
Inside of a loop after an array of booleans have been allocated, the invariant allocated(sieve) reports true however, attempting to assert the Preserved predicate on the sieve array after an ...
0
votes
0
answers
35
views
Can a kernel memory address indicate its type of allocation?
I'm troubleshooting some Linux kernel code, and it would be nice to know where the memory pointer allocation originated.
Question: Are there Linux kernel macros available like ADDR_IS_STACK_ADDR(ptr) ...
-6
votes
0
answers
76
views
Static variables in C++ [duplicate]
Where are static variables allocated in C++? On the stack or the heap?
Also, I read in 7.9 — The stack and the heap that all memory allocated on the stack is known at compile time. Is it true? Does it ...
-2
votes
0
answers
7
views
sir my electon project run but make build in earror occurs javascript heap memory errors
my project is a block coding program frok from open block desktop with a repository size of around 10 GB and makes build not build and error accord javascript heap memory. javascript heap memory ...
0
votes
1
answer
59
views
LLVM Analyzer Garbage value
I work on a custom container and I manually allocate some heap memory:
template<typename element_type>
class MyClass{
element_type* m_data = nullptr;
std::size_t rows, columns; // assume ...
0
votes
1
answer
35
views
How to know heap overflow point?
I'm attempting to write a program that determines all palindrome within a given range. My program calls a function (number of digits) that returns the size of an integer (ie. 400 would be 3 as it has ...
-2
votes
0
answers
51
views
c++ heap vs stack allocation for append function call [duplicate]
If I have a string in C++:
std:string a = std:string("haha");
Does it get allocated on the stack since it's a local variable? Or since it's the std::string type, does it directly go on the ...
-1
votes
0
answers
31
views
Getting Out of Memory error message while doing execution
I am doing performance execution and have Gatling project which is combined with these (Intellij+ Maven+ Java).
When we start execution after some time let say 20sec getting out of memory error ...
0
votes
0
answers
83
views
What is a proper way to initialize object on stack or on heap?
tl;dr; What is a proper way to initialize object on stack or on heap?
I want to make a profiling tool that can track time for iterative purposes and for single measurements - so that I can use same ...
1
vote
2
answers
160
views
C free() on Ubuntu VM, a question regarding heap memory
A simple program to allocate and free heap memory:
int main(int argc, char **argv) {
char *b1, *b2, *b3, *b4, *b_large;
b1 = malloc(8);
memset(b1, 0xaa, 8);
b2= malloc(16);
memset(...
2
votes
0
answers
34
views
Build wasm with import memory wasm
I want to write code in rust which I will then compile into wasm so that it uses import memory.
In the compiled file the wasm from rust want to see similar code
(module
(import "host" &...
-3
votes
2
answers
63
views
Define/Initialize Vectors on Stack vs Heap [closed]
I declare two vectors in my class header file as follows:
struct MYDATA
{
uint8_t A = 0;
uint8_t B = 0;
};
std::vector<MYDATA> vector1;
std::vector<MYDATA> *vector2 = new std::...
2
votes
1
answer
103
views
Why does Go's escape analysis move a variable to the heap even when inlining is applied?
Given this:
package main
func main() {
_ = f()
}
func f() *int {
y := 2
res := y * 2
return &res
}
If you run:
go build -gcflags '-m'
To get the escape analysis, it says this:
....
0
votes
2
answers
45
views
How can I increase the survival cycle of an object moving from young generation to old generation heap space in java
I have a spring boot application development which is processing an memory intensive process for an amount of time which is let than 5 mins. It will create lots of objects created and it will be ...
1
vote
3
answers
90
views
Invalid heap pointer
I'm practicing the implementation of Linked list code. so I write the code:
file LinkedList.c
#include <stdio.h>
#include "function.h"
int main(void) {
//initialize
struct Node ...
1
vote
1
answer
38
views
Tomcat 9 on Ubuntu - where does the initial Xmx come from?
Installed Tomcat 9.0.89 on ubuntu, with openjdk 11.0.22.. without altering anything, starting up Tomcat I see
/usr/lib/jvm/java-... -Xms512M -Xmx1024M -server ...
Where does those -Xms/x come from? ...
1
vote
0
answers
55
views
How to Remove an Instance from Heap Memory in Flutter Dart?
I'm working on a Flutter project and I'm trying to understand how to properly manage memory. Specifically, I want to know how I can remove an instance from heap memory in Dart.
I understand that Dart ...
0
votes
0
answers
24
views
Finding where these instances used which consuming more memory
I'm debugging/analyzing Springboot application using VisualVm and Eclipse Memory analyzer tools to find out where heap memory used more. After that plan is to see how can we avoid such instances to ...
2
votes
1
answer
47
views
large number of heap allocations in database query results
I am implementing the Rows interface in sql/driver. When implementing the Next(dest []Value) error method, I found that when the result of data is very large, heap allocation will become a performance ...
2
votes
1
answer
84
views
Does redim use the heap or the stack memory in VBA?
I know this is quite strange to ask for a language that is far from a low-level language such as C and C++, but it caught my attention that for example if I do this:
Dim tempArray(0 To 2) As Integer
...
1
vote
1
answer
62
views
String.Intern result inconsistency and possible use cases
string s1 = new string (new char[] { 'H', 'e', 'l', 'l', 'o' });
string i1 = string.Intern(s1);
bool result1 = ReferenceEquals(s1, i1);
string s2 = new string(new char[] { 'H',...
0
votes
0
answers
31
views
Why DirectByteBuffer keeps data on JVM heap instead of native memory in Android?
I wanted use ByteBuffer.allocateDirect to keep data on native memory but it looks like it keeps data on heap.
I used this code to check that DirectByteBuffer keeps data on heap.
import android.util....
-1
votes
2
answers
88
views
Returning a pointer on the heap and the consequential behaviour [duplicate]
Imagine I have the below scenario: Now if I allocate a pointer inside a function on the heap, and return this pointer back to the main program, is the memory still on the heap, and do I have to free ...
2
votes
1
answer
86
views
How to make JVM only use large heap size when necessary
I have a Java application running in a container (eclipse-temurin:21-jre-alpine) in a Kubernetes cluster, and I'm trying to optimize its memory usage.
The required heap size is very spiky. By default, ...
-3
votes
1
answer
76
views
How is Numpy able to get an array size at run-time?
In C++ the size of an array must be determined at the compile-time.
I want to write a simple code in C++, say, to do a naive matrix multiplication with itself (for a matrix that is square in size) and ...
0
votes
2
answers
85
views
ConcurrentHashMap$Node accumulate in heap without clean by GC
I am using ConcurrentHashMap to cache some short-lived data. That is, there are not many entries in the cache, but insertion and deletion often occur. The problem is that when working under load, GC ...
0
votes
0
answers
13
views
UniVocity is not releasing memory
I need to compare 2 huge csv file contents based on certain preprocessing... i have done with my logic but process takes much time for huge files so i used univocity Parser it performs faster but it ...
0
votes
1
answer
104
views
"A breakpoint instruction (__debugbreak() statement or a similar call) was executed" without breakpoint :(
Member.h
pragma once
#ifndef MEMBER_H
#define MEMBER_H
#include <iostream>
#include <string>
using namespace std;
class Member {
private:
char* m_id;
char* m_pwd;
char* ...
1
vote
0
answers
34
views
Out of Heap Memory Error when Generating Multiple PDFs using Itext7 library in Java
I have a Java method that generates PDFs from HTML templates using the iText 7 library. The method works fine for generating a small number of PDFs, but when I try to run this code with 10 threads and ...
1
vote
1
answer
25
views
Is it possible to determine whether and address was obtained using sbrk or mmap?
I am developing a heap memory allocator based on Hoard for educational purposes. I know how to allocate memory using sbrk and mmap and have developed toy level allocators before.
I want to use mmap ...
1
vote
0
answers
35
views
When trying to get interface name using Linux call if_indextoname, returned pointer is crashing
While trying to get interface name using below code, returned pointer p is crashing. Can someone help?
#include <net/if.h>
char *p = NULL, buf[IFNAMSIZ]='\0';
int i = 0;
for(i=0; i<50; i++)
{...
0
votes
1
answer
77
views
Size of a Kotlin class that contains custom objects as it's data members
I understand that in Kotlin(or Java) an object is a referenced type. i.e.
private var Object1: Obj1? = Obj1()
Here var Object1 is a reference(8 bytes) to the instance of class Obj1(on Heap).
Thus, If ...
0
votes
0
answers
25
views
What is "i" in chrome memory heap snapshot?
I am doing a memory analysis for my application. And this i is taking a lot of space. It is storing many objects with same properties from application.
1
vote
0
answers
64
views
unknown memory leak in Qt6 C++
I installed deleaker and decided to test it on a small code, as a result, I got 1 error about a memory leak, which, as for me, should not be and I do not understand where it comes from
...
0
votes
2
answers
78
views
Correct syntax to access array elements in structs?
First-year comp sci student, and first time posting on here.
I have a struct:
struct Student{
string name;
int studentID;
int numTests;
int *testScores = new int [TESTS]; //Access with ...
0
votes
0
answers
42
views
How to detect when a handle to my process is opened with OpenProcess from a foreign process? [duplicate]
I have this code to get all handle of some process by PID using NtQuerySystemInformation()
#ifndef UNICODE
#define UNICODE
#endif
#include <windows.h>
#include <stdio.h>
#include <...
0
votes
0
answers
21
views
why is RSS 5x the size of heap Total, Array buffer and External combined?
i would like to monitor my applications memory usage.
most of the APM tools provide insights to heap usage. which according to my understanding is normal in my case.memory allocation
i want to know ...
0
votes
1
answer
60
views
Stack size in relation to virtual memory
In our Operating Systems class we mentioned virtual memory as a mechanism that abstracts physical memory to a process, and that it looks something like this (per process):
The stack grows down the ...
0
votes
1
answer
102
views
"java.lang.OutOfMemoryError: Java heap space" with big bidimensional arrays
I made a small program for splitting big files into smaller ones with Java.
The code is the following:
import java.io.*;
public class Main {
final static int DIM = 6;
final static int GB = ...
0
votes
2
answers
101
views
Does Stack being limited in size mean i can only get limited pointers to objects in heap?
if stack size is 1MB, does that mean i can only get less than 1000000/8 pointers to allocate ints in heap? (considering 1MB free stack) yeah i know you might not want to make that many individual ints ...
0
votes
0
answers
222
views
Angular project increases memory usage after every refresh
I have a problem in my Angular website and I am not sure what is the cause. Every time I refresh the page the memory usage increases by 100-150 mb of ram. I have already tried most of the recommended ...
0
votes
1
answer
198
views
Reached heap limit Allocation failed - Javascript heap out of memory, even though my laptop has 32GB RAM
I just bought a new device for better work performance, and tried to run my project on it. It is an angular project that uses angular 11, and in my old laptop normally I have to set max old space size ...
-3
votes
2
answers
120
views
Why is there no time cost to large stack allocations
I tried this quick-bench test and I'm finding that it's the same cost timewise to allocate 200 bytes as it is to allocate 2000000 bytes.
How could that possibly be?
1
vote
0
answers
31
views
How does one free memory in the heap in risc-v assembly? [duplicate]
I am currently studying risc-v assembly and started to research more about the heap. In the current problem I'm solving, I'm creating a linked list by allocating space on the heap with a syscall and ...
0
votes
0
answers
12
views
How to assign the stack/heap area into the external ram
How could I assign the stack/heap area into the external RAM on the KEIL SDK.
My scatter file is like the following.
LR_IROM1 0x01008000 0x00400000 { ; load region size_region
ER_IROM1 ...
0
votes
1
answer
19
views
How to copy a CVariable to the heap in Kotlin/Native
I have a CVariable that was created inside of memScoped { } which means that when I return something from memScoped { }, the memory would be freed which means that I'd run into a use-after-free which ...
1
vote
0
answers
51
views
Wipe memory after garbage collector execution in Android
I have some sensitive information in an app that I want to keep in memory for as little time as possible.
One of them is, for example, the refresh token. When refreshing the tokens, I get a new ...