aspose file tools*
The moose likes Beginning Java and the fly likes ArrayList Size Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "ArrayList Size" Watch "ArrayList Size" New topic
Author

ArrayList Size

narayana arya
Greenhorn

Joined: Dec 12, 2005
Posts: 12
Does anybody knows ArrayList Maximum Size?
if i give ArrayList al=new ArrayList(Integer.MAX_VALUE);

then it is giving this exception:

java.lang.OutOfMemoryError: Requested array size exceeds VM limit
Tony Morris
Ranch Hand

Joined: Sep 24, 2003
Posts: 1608
Integer.MAX_VALUE is the maximum size of an ArrayList.
You are encountering an exhaustion of heap space (a failed alloc by the VM).
You can simply give your VM more heap space using the -Xmx option when you start it up


Tony Morris
Java Q&A (FAQ, Trivia)
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: ArrayList Size