title: How to measure sum of collected memory of Young Generation?
body: <p>I'd like to measure memory allocation data from my java application, i.e. the sum of the size of all objects that were allocated. Since object allocation is done in young generation this seems to be the right place.</p>
  
  <p>I know jconsole and I know the JMX beans but I just can't find the right variable... Right at the moment we are parsing the gc log output file but that's quite hard. Ideally we'd like to measure it via JMX...</p>
  
  <p>How can I get this value?</p>
  
  <p><strong>Additional info after comment of Chadwick:</strong></p>
  
  <p>I want to know how much memory my application is using. It's quite a big software running in a JBoss Appserver. Every 4 weeks there is a new release of the software and we need to compare the memory consumption between old and new version. It's not enough to compare the current value of the old generation at a specific time. It's very useful to know how much more / or less memory gets allocated. Since many objects are getting collected in the young generation I need to measure it there.</p>
  
  <p>In the meantime I have an estimate for this. I will post it as an answer.</p>
  
  <p>Thanks,
  Marcel</p>