LIST与大数据量的处置

LIST与大数据量的处理
public class ListTest
{
    public static void main(String[] args)
    {
        long start = System.currentTimeMillis();
        List ll = new ArrayList(0);
        List<List<String>> list = new ArrayList<List<String>>(12);
        List<String> l = new ArrayList<String>(12);
        for (int i = 0; i < 1000000; i++)
        {
            if ((i + 1) % 50000 == 0)
            {
                list.add(l);
                l = new ArrayList<String>();
            }
            l.add(i + "aaaaaa");
         }
        long end = System.currentTimeMillis();
        
        System.out.println(end - start);
    }
}



我将100W条数据放入LIST中。会报:java.lang.OutOfMemoryError: Java heap space错误。

请问怎样解决这种问题??
1 楼 remoteJavaSky 2012-01-14  
那就把 heap 调大些,或者根本的解决方案是,不要出现那样大的数组,如分页