• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

setting heap size

 
Ranch Hand
Posts: 375
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I know we can set -Xmx256m kind stuff in the eclipse run configuration panel's arguments/ Question --

1. what's the default heap size for each application ?

2. when you set "-Xmx256m", does it mean you allocate that much memory for your application ? Then don't you need to consider what's the memory of your PC ? what if you set -Xmx1024m but you don't have 1024M memory ? Plus, even if you have 1024M memory, if you set -Xmx 512m, then does it mean other application can only share the remaining 512m ?

3. in a production env, if each application set -Xmx512m, then potentially each of them consumes so much memory, is that true ?

Fundamentally, I want to understand when you do "java myapp -Xmx512m", does it mean you allocate at most 512M to "myapp" only ?
 
author and iconoclast
Posts: 24204
44
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It means that the Java heap can grow to that size, at maximum, for that application. It will generally start smaller, and will grow as needed up to that size, but no larger. The maximum amount used by your application will actually be larger, because the Java heap size doesn't count the space taken up by the VM implementation, etc.

In any case, do you understand the idea of "virtual memory"? All modern operating systems effectively use your disk space as extra RAM, so that the total amount of memory needed by all running programs can actually be larger than the amount of physical memory you have. How well the computer handles that situation depends on the OS and on the hardware, of course.
 
Can you really tell me that we aren't dealing with suspicious baked goods? And then there is this tiny ad:
free, earth-friendly heat - a kickstarter for putting coin in your pocket while saving the earth
https://coderanch.com/t/751654/free-earth-friendly-heat-kickstarter
reply
    Bookmark Topic Watch Topic
  • New Topic