|
[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Eclipse: the new Emacs? (and the XML story)
Bob Foster wrote: >K. Ari Krupnikov wrote: > > David Megginson <dmeggin@a...> writes: > > > >>Java objects have an awful lot of built-in > >>memory overhead just for the java.lang.Object base class > > > > Do you know how much memory you actually use for a "new Object()"? > >Yes, a pinch of actual fact would make a nice spice for this latest >round of the "objects cost too much" permathread. > > > In older JVMs (1.1.8) even a simple Object would take about 32 bytes. Now that's down to 8 bytes, for the Sun JVM 1.4.2 on Linux: Base Object starting memory usage 884792, ending usage 2484792 Base Object size in bytes: 8 Base Object construction time in ms. for 200000 instances: 59 String (4 characters) starting memory usage 884952, ending usage 10484952 String (4 characters) size in bytes: 48 String (4 characters) construction time in ms. for 200000 instances: 851 Integer starting memory usage 884952, ending usage 4084952 Integer size in bytes: 16 Integer construction time in ms. for 200000 instances: 135 byte Array (0 length) starting memory usage 884952, ending usage 4084952 byte Array (0 length) size in bytes: 16 byte Array (0 length) construction time in ms. for 200000 instances: 128 byte Array (8 length) starting memory usage 884952, ending usage 5684952 byte Array (8 length) size in bytes: 24 byte Array (8 length) construction time in ms. for 200000 instances: 211 Reference Array (8 length) starting memory usage 884952, ending usage 10484952 Reference Array (8 length) size in bytes: 48 Reference Array (8 length) construction time in ms. for 200000 instances: 628 This is from a modified version of the code I used for a JavaWorld article a few years back (the article now mostly obsolete, so I won't link it). Don't know why Strings are so slow and so large (figure 24 bytes for the char[4], but that still leaves another 24 bytes just for the String data), but it would certainly account for a lot of the bloat in document models. In general, document models take about 4-8X the document size in bytes (with the low end for documents that are mostly text): http://www.sosnoski.com/opensrc/xmlbench/results.html#size These results are a couple of years old (and from a 1.3.X JVM), but still fairly accurate from what I've seen. - Dennis -- Dennis M. Sosnoski Enterprise Java, XML, and Web Services Training and Consulting http://www.sosnoski.com Redmond, WA 425.885.7197
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|
|||||||||

Cart








