Skip to content

OOM in random generation #23

@patrickdalla

Description

@patrickdalla

I have made two simple test (below). The first, with SparseBitSet gives me OOM. The second works without much memory usage. What I made wrong?

    public static void main(String[] args) {
        SparseBitSet[] sbs = new SparseBitSet[1000000];  
        for(int i=0; i<1000000; i++) {
            sbs[i]=new SparseBitSet();
            for(int j=0; j<100; j++) {
                sbs[i].set((int)(Math.random()*1000000));
            }
        }
        System.out.println();
}

and

        IntArrayList[] sbs = new IntArrayList[1000000];  
        for(int i=0; i<1000000; i++) {
            sbs[i]=new IntArrayList();
            for(int j=0; j<100; j++) {
                sbs[i].add((int)(Math.random()*1000000));
            }
        }
        System.out.println();

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions