This week's book giveaway is in the Design forum.
We're giving away four copies of Design for the Mind and have Victor S. Yocco on-line!
See this thread for details.
Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

ArrayList Size

 
narayana arya
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1608
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic