• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Use of Javap

 
Ranch Hand
Posts: 83
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I compiled a class first with no option

javac Vertex.java --- File Size - 887 Bytes

Then I compiled the same class as

javac -g:none Vertex.java -- The File size was - 667 now.

However, when I did

javap with each of the above class files - each of different sizes, the generated output is the same.

Why is this so ??

Are the extra bytes - when the class is compiled with Debug On - just debug related info and nothing to do with actual Instruction/ByteCodes
 
author and iconoclast
Posts: 24207
46
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
Yes, of course -- what else would debugging info be besides... debugging info? The difference is mainly local variable tables -- information that lets a source debugger know what variable names to use for JVM registers at each line of code.
 
sopal Pal
Ranch Hand
Posts: 83
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ok, so my guess was right.

Now, if I load 100,000 instances of a Class file - which was compiled WITH Debug Info - is more memory in the JVM HEAP consumed than - if I had loaded 100,000 instances of the same class - which had NO debug info.
 
Ernest Friedman-Hill
author and iconoclast
Posts: 24207
46
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
First, note that creating 100,000 instances of a single class will load the class file only once. Each instance shares the same data about the class.

The only way to load the class file 100,000 times would be to create 100,000 separate class loaders, and load the class once into each one.

But in any case: I don't think so. The runtime JVM has no need of line number tables -- I don't believe they'd be loaded, but I'm not 100% sure of that.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic