• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Use of Javap

 
sopal Pal
Ranch Hand
Posts: 83
  • Mark post as helpful
  • send pies
  • 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
 
Ernest Friedman-Hill
author and iconoclast
Marshal
Pie
Posts: 24208
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • 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
  • 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
Marshal
Pie
Posts: 24208
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • 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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic