my dog learned polymorphism*
The moose likes Java in General and the fly likes Use of Javap Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Use of Javap" Watch "Use of Javap" New topic
Author

Use of Javap

sopal Pal
Ranch Hand

Joined: Aug 04, 2003
Posts: 83
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


SCEA, SCBCD, SCJP1.4, OOAD-UML, OCP 9i
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24183
    
  34

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.


[Jess in Action][AskingGoodQuestions]
sopal Pal
Ranch Hand

Joined: Aug 04, 2003
Posts: 83
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

Joined: Jul 08, 2003
Posts: 24183
    
  34

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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Use of Javap
 
Similar Threads
finding javac version used to compile a class
java mail excel attachment problem
Compile with Debug and with No Debug
Class size optimization
An interesting Question on default constructor