• Post Reply Bookmark Topic Watch Topic
  • New Topic

Overwhelming the JVM and system ?  RSS feed

 
Raghavendra Shockley
Ranch Hand
Posts: 69
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is it possible to create a "large" number of objects and completely fill all your free RAM ?
 
Maneesh Godbole
Bartender
Posts: 11445
18
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Surely its easier to try it out yourself isnt it? A while loop suggests itself.
 
Anayonkar Shivalkar
Bartender
Posts: 1558
5
Eclipse IDE Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Raghavendra Shockley wrote:Is it possible to create a "large" number of objects and completely fill all your free RAM ?

Yes. It is absolutely possible. As long as you are holding references to the objects, those won't be garbage collected. Chances are you'll get OutOfMemoryError and JVM will crash.
 
Jeff Verdegan
Bartender
Posts: 6109
6
Android IntelliJ IDE Java
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Note, however, that your system may impose limits on the maximum amount of memory a single process is allowed to use. If this value is smaller than the total amount of RAM on the system, then you won't be able to use it all with a single program, Java or otherwise. You can of course still easily use up all the memory the JVM is allowed.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!