Memory Leak in IntelliJ IDEA 11.1.1 CE

Dear IntellliJ Community,

I have been running into java.OutOfMemory with my program which stores information in a fairly large matrix (7000000 by 6) in IntelliJ. Even when I increase the heap space in both Info.list and the compiler, the program always gets stuck at the same point.

So to test whether there was a leak, I created a jar file, and ran it with the computer (mac osx) java compiler (javac). This was able to run the program on 512m available heap space, while in IntelliJ there was no improvement even when I increased the heap space to ~2GB.

The memory requirements for my large matrixwhen I ran it as a jar file makes sense. It really does not need 2GB java heap space. Therefore, I think there is a serious problem with IntelliJ which needs to be addressed as I have seen several posts with regard to this issue.

I have attached my test matrix program for others to test. I hope this helps.

Thanks

Jayna


//Posted code by Jayna

import java.util.ArrayList;
import java.util.List;
import java.util.Vector;

/**
* Created with IntelliJ IDEA.
* User: jr207
* Date: 5/14/12
* Time: 1:40 PM
* To change this template use File | Settings | File Templates.
*/
public class maxMatrix {

    private int n = 2817100;
    private int d = 6;

    private int max = Integer.MAX_VALUE;

    public void run(int n, int d) {

        int xSize = d;
        int ySize = n;

        ArrayList<int[]> matrix;

        matrix = new ArrayList<int[]>();
        int[] rowEntry;
        while(ySize<max) {
            matrix.clear();
            matrix.ensureCapacity(ySize);

            Vector  vector;

            for(int j=0; j<ySize; j++) {
                rowEntry = new int[xSize];

                matrix.add(rowEntry);

            }

            System.out.println(matrix.size());
            ySize++;

        }






    }
    public static void main(String[] args) {


        maxMatrix x = new maxMatrix();
        x.run((int)Integer.valueOf(args[0]),(int)Integer.valueOf(args[1]));


    }

}



Attachment(s):
maxMatrix.jar
2 comments
Comment actions Permalink

If you are running the application from within IntelliJ then you need to edit the VM options settings in the Run Configuration for that appliction.

Just select "Edit Configurations..." and add a VM Option "-Xmx2g " and you should be OK.

0
Comment actions Permalink

Great, that worked! Thanks!

0

Please sign in to leave a comment.