FAQ Database Discussion Community


Thread '
' has overflowed its stack when allocating a large array using Box

rust,heap-memory,dynamic-memory-allocation
I'm trying to create fixed-size array in stack, but it shows stack overflow, then I change it to heap (it said to allocate in the heap we must use box), but it still shows an stack overflow. fn new_gap(gap: usize) -> usize { let ngap = ((gap as f64) /...

Strange error while adding a feature to my little game (0xC0000005)

c,memory-management,memory-leaks,heap-memory
Hello everyone, I decided some time ago to write my own version of Minesweepers as some practice and I did it. The game ran perfectly, but after deciding to add a "Choose difficulty" option the window freezes and I get an error message, saying that the program does not respond....

Mutex assertion error with non-zero heap

c,pthreads,mutex,heap-memory,memset
If I allocate memory, free it and then try to allocate a mutex and lock it, I get the message Assertion 'mutex->__data.__owner == 0'. I am not an expert in concurrency or low-level programming but this seems odd to me. Code #include <stdlib.h> #include <string.h> #include <pthread.h> void nonzero_heap(){ void...

C++ Pointer Object Location

c++,heap-memory,stack-memory
I have the following C++ code: struct B { int c; int d; } struct A { int a; B x; } int main() { A * ptr = new A; ptr->a = 1; ptr->x.c = 2; ptr->x.d = 23; // a lot of lines of codes later ... //...

Heap memory consumed more than committed memory

java,heap-memory,jprofiler
Can heap memory increase beyond the cap of -Xmx memory? I have -Xmx set to 1G. The profiling screenshot captured from JProfile shows the heap growing beyond 1G and sometime doubling to 2G. What then is the meaning of -Xmx ? ...

create vector of objects on the stack ? (c++)

c++,vector,heap-memory
I am creating a temporary vector of pointers to myObject objects. But I am wondering about what happens to the objects I created... { std::vector<myObject *> myVector; myVector.reserve(5); for (int i = 0 ; i < 5 ; ++i){ myVector[i] = new myObject(); } } I assume that at the...

TaskManager android that will show current memory usage and cpu usage

java,android,cpu-usage,heap-memory,taskmanager
I am making a Project on TaskManager android just like windows Taskmanager. How to get CPU usage and memory Usage?

CUDA memory access violation when creating an object in kernel function

c++,memory,cuda,access-violation,heap-memory
To allocate a large memory in CUDA kernel function using operator new I set the value of cudaLimitMallocHeapSize to the size of free device memory ~1.7-1.8G at every launch. But if I try to create an object in kernel function I get a memory access violation in the line i...

Windows Heap Chunk Header Parsing and Size Calculation

debugging,heap,reverse-engineering,windbg,heap-memory
How can I calculate heap chunk size from raw bytes read from memory. I tried below thing. 0:001> !heap Index Address Name Debugging options enabled 1: 00500000 2: 00280000 3: 008f0000 4: 00ab0000 5: 00cc0000 0:001> !heap -a 00500000 .. .. Heap entries for Segment00 in Heap 00500000 address: psize...

Call-by-value of a c struct containing a pointer to heap allocated memory

c,struct,heap-memory
Dear stackoverflowers. During some experimenting with c and structs, me and a friend of mine came across something we cannot quite get our heads around. Below is a code snippet describing a struct with an int pointer and a variable. They are both set whilst creating the struct in the...

memory corruption error during allocation

c++,qt,heap-memory,dynamic-memory-allocation
my code in C++ using QT gives me memory corruption error when I go through this part of the code: for (int vid=0;vid<m_trajs.size();vid++) { QVector<int*> clusterIDs_foronevideo; for (int level=0;level<nbClusters.size();level++) { int* clusterIDs_atonelevel = new int [long_vals[vid]]; for (int ind=0;ind<stInd[vid];ind++) { clusterIDs_atonelevel[ind] = clusterIDs[level][ind]; } clusterIDs_foronevideo << clusterIDs_atonelevel; } m_clusterIDs <<...

If “Heap” memory usage shown in JConsole usually returns to 0 after GC, is there no memory leak?

java,memory-leaks,heap-memory,jconsole
I've been trying to use JConsole to identify whether or not I have a memory leak. I let my code run for a long time, and ensure it performs many iterations of all functions available, starting/ stopping all threads many times, instantiating and releasing every object many times, encountering as...

Infinite loop without accepting input

c++,infinite-loop,heap-memory
I am writing a simple C++ Program which allocates dynamic memory to my Program and then deletes this memory. Here is my Program: #include <iostream> #include <new> using namespace std; int main () { int i,n; int * p; cout << "How many numbers would you like to type? ";...

uninitialized data segment of program memory

memory-management,heap-memory
In Uninitialized Data Segment, the kernel initialize the uninitialized variable to 0. But if we directly use an uninitialized variable (for eg. int sum; and not int sum=0; ) and use it in program like sum=sum+n(n be any number), sum will take any garbage value. So why the sum will...

Predictionio evaluation fails with empty.maxBy exception and training with java.lang.OutOfMemoryError

java,heap-memory,evaluation,training-data,predictionio
I have downloaded the latest update on text classification template. I created a new app and imported stopwords.json and emails.json by specifying app id $ pio import --appid <appID> --input data/stopwords.json $ pio import --appid <appID> --input data/emails.json Then I changed engine.json and given my app name in it. {...

Why doesn't malloc allocate memory at all?

c,linux,memory,malloc,heap-memory
I have the following struct: struct block { void *addr; /*start address of memory for this block */ int size; struct block *next; }; I have the following code to initialize each block: void block_init(struct block *b, void *addr, int size){ /*Allocate space and fill b with the initial data.*/...

How do I release images and avoid outOfMemory exc-n when navigating back and forth between activities[android]

android,out-of-memory,heap-memory,android-memory
I have a children tale app - 18 pages, each page is an activity with a background image, short story and sound for every word(textView) in a story, and some animations. I notice, when i go to next page, the memory is consumed; it is also consumed when i go...

How to set Java heap size (Xms/Xmx) inside Docker container?

java,docker,heap-memory
As of raising this question, Docker looks to be new enough to not have answers to this question on the net. The only place I found is this article in which the author is saying it is hard, and that's it.

Unable to process large PDF file

java,itext,heap-memory,ioexception
I have jave file with size 160MB. When I try to load it in PdfReader (Itext Library) it fire following error: java.io.IOException: Not enough storage is available to process this command I am using Java Version 1.5 (32bit). Code: PdfReader pdfReader = null; try{ pdfReader = new PdfReader("D://bigfile.pdf"); //also try...

Access the memory values (as ruby objects) inside a running Ruby program?

ruby,heap-memory,dtrace,hijack
There's a great program called Hijack that lets you get an irb shell for a running ruby process, but it doesn't seem compatible with newer version of ruby. Are there any known alternatives? I'm thinking maybe something like strace/dtrace if I want to get really hardcore. It wouldn't get me...

How to handle “[ERROR] Exception in thread ”main“ java.lang.OutOfMemoryError: Java heap space” in JENKINS?

java,maven,gwt,jenkins,heap-memory
I have been building GWT war file on Jenkins. In a specific "job" I have encountered an error which says [ERROR] Exception in thread "main" java.lang.OutOfMemoryError: Java heap space. As a solution, I have included an environment variable "MAVEN_OPTS" with a value of -Xms512m -Xmx1024m -XX:MaxPermSize=512m. FYI, I have also...

My Mac is not taking my Heap Size configurations

java,eclipse,osx,heap-memory
I'm trying to work with thousands of live objects on my Mac. I tried to change the heap size in the eclipse.ini to 2G but according to my jconsole Java is still limiting to 130mb and throwing Java Heap Space error out of memory. It seems that Java doesn't take...

How to increase Java heap space on Spark Amazon EC2 cluster?

java,amazon-web-services,amazon-ec2,apache-spark,heap-memory
I wrote a program using Java Spark API. Given my data is big, I am getting the following error java.lang.OutOfMemoryError: Java heap space Any idea how to increase java heap space of Spark EC2 cluster on Aws? I can give details about my code and cluster setup if necessary. Thanks....

Tomcat Permgen not increased even if I put it in Java options

java,tomcat,heap-memory,permgen
I'm running Tomcat 7 as a windows service in a Windows Server 2008 Machine. I've got a Java.lang.OutOfMemoryError: PermGen space so I'm trying to increase its PermGen memory heap. So I specify this line at the end of JVM options: -XX:PermSize=512m -XX:MaxPermSize=512m -XX:+CMSClassUnloadingEnabled -XX:+CMSPermGenSweepingEnabled -XX:+HeapDumpOnOutOfMemoryError As specified in the picture...

NETBEANS: “java.lang.OutOfMemoryError: Java heap space” [duplicate]

java,netbeans,heap-memory
This question already has an answer here: How to deal with “java.lang.OutOfMemoryError: Java heap space” error (64MB heap size) 14 answers I encountered an error in Netbeans: java.lang.OutOfMemoryError: Java heap space This is the first time I encountered this and I don't know how to deal with it. Can...

Memory management in Contiki-OS

memory-management,heap-memory,contiki
I am trying to create a port for Contiki-os to LPC1347, and i have a question as to how exactly is memory handled in Contiki. Protothreads are stack-less and no "real threads" are used so everything is basically on the same stack, so it is basically static memory allocation. I...

Category implementation stuck in thread with increasing memory heap space

objective-c,heap-memory
I am learning Categories in Objective-C. I am trying to write a sample program with categories in XCode and the program execution hangs on one line as shown in the image, but the memory keeps increasing. I hope that someone can help. I have attached snapshot below. The source code...

How to find memory leaks using app dynamics

jvm,heap,heap-memory,appdynamics
Could anyone explain me how to find memory leaks with the help of app dynamics.I tried to search but could not find any proper answer.

Why in C++ overwritingis is slower than writing?

c++,performance,stack,heap-memory
I have to run a piece of code that manages a video stream from camera. I am trying to boost it, and I realized a weird C++ behaviour. (I have to admit I am realizing I do not know C++) The first piece of code run faster than the seconds,...

c++ dynamically declared array fails to work

c++,memory-management,new-operator,theory,heap-memory
I am trying to read the file's data into a dynamically declared array, using double *data = new double[14141414]() declaration. Note, it is rather a large file; hence large size of an array. The problem is I can not put all the data into an array as somewhere around index=14000000...

Is an attempt to modify a const_cast-ed, but dynamically allocated constant object still undefined behavior? [duplicate]

c++,compiler-optimization,heap-memory,undefined-behavior,const-cast
This question already has an answer here: Can a heap-allocated object be const in C++? 6 answers For example: const int* pc = new const int(3); // note the const int* p = const_cast<int*>(pc); *p = 4; // undefined behavior? In particular, can the compiler ever optimize away the...