How to increase the memory heap size on IntelliJ IDEA?

Use Help | Edit Custom VM Options… An editor will open automatically for the right .vmoptions file, adjust the value of -Xmx, save and restart IntelliJ IDEA: Check these documents from IntelliJ IDEA knowledge base for more details: Configuring JVM options and platform properties The JVM could not be started. The main method may have … Read more

Visual Studio – how to find source of heap corruption errors

Begin with installing windbg: http://www.microsoft.com/whdc/Devtools/Debugging/default.mspx Then turn on the pageheap like this: gflags.exe /p /enable yourexecutable.exe /full This will insert a non writable page after each heap allocation. After this launch the executable from inside windbg, any writes outside the heap will now be caught by this debugger. To turn of the pageheap afterwards use … Read more

Where in memory are string literals ? stack / heap? [duplicate]

The string literal will be allocated in data segment. The pointer to it, a, will be allocated on the stack. Your code will eventually get transformed by the compiler into something like this: #include <stdio.h> const static char literal_constant_34562[7] = {‘t’, ‘e’, ‘s’, ‘a’, ‘j’, ‘a’, ‘\0’}; int main() { char *a; a = &literal_constant_34562[0]; … Read more

Why a sawtooth shaped graph?

The sawtooth pattern in the heap usage can be explained by the fact that several local variables are created during the invocation of the System.out.println invocation. Most notably in the Oracle/Sun JRE, several HeapCharBuffer instances are created in the young generation, as noted in the following snapshot obtained using the memory profiler of VisualVM: The … Read more

Suggestions to avoid bitmap Out of Memory error

just use this function to decode…this is perfect solution for your error..because i also getting same error and i got this solution.. public static Bitmap decodeFile(File f,int WIDTH,int HIGHT){ try { //Decode image size BitmapFactory.Options o = new BitmapFactory.Options(); o.inJustDecodeBounds = true; BitmapFactory.decodeStream(new FileInputStream(f),null,o); //The new size we want to scale to final int REQUIRED_WIDTH=WIDTH; … Read more

How to view the current heap size that an application is using?

Use this code: // Get current size of heap in bytes long heapSize = Runtime.getRuntime().totalMemory(); // Get maximum size of heap in bytes. The heap cannot grow beyond this size.// Any attempt will result in an OutOfMemoryException. long heapMaxSize = Runtime.getRuntime().maxMemory(); // Get amount of free memory within the heap in bytes. This size will … Read more