Groups | Search | Server Info | Keyboard shortcuts | Login | Register
Groups > comp.lang.java.programmer > #5748
| Path | csiph.com!x330-a1.tempe.blueboxinc.net!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!border3.nntp.dca.giganews.com!Xl.tags.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!local2.nntp.dca.giganews.com!nntp.earthlink.com!news.earthlink.com.POSTED!not-for-mail |
|---|---|
| NNTP-Posting-Date | Tue, 28 Jun 2011 14:34:22 -0500 |
| Date | Tue, 28 Jun 2011 12:34:15 -0700 |
| From | Patricia Shanahan <pats@acm.org> |
| User-Agent | Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.17) Gecko/20110414 Thunderbird/3.1.10 |
| MIME-Version | 1.0 |
| Newsgroups | comp.lang.java.programmer |
| Subject | Re: Why "lock" functionality is introduced for all the objects? |
| References | <d0bb9e06-16f0-4282-a37e-47e9ca9630ec@r2g2000vbj.googlegroups.com> <iuce66$2nh$1@news.albasani.net> <iud083$2jr$1@news.onet.pl> <iud1u5$f4r$1@news.albasani.net> <iud4f6$lcm$1@news.onet.pl> <iud5js$nno$1@news.albasani.net> <iud66f$8al$1@speranza.aioe.org> <J5KdnRBP4eYkvZfTnZ2dnUVZ_jqdnZ2d@earthlink.com> <iud80u$ci0$2@speranza.aioe.org> |
| In-Reply-To | <iud80u$ci0$2@speranza.aioe.org> |
| Content-Type | text/plain; charset=UTF-8; format=flowed |
| Content-Transfer-Encoding | 7bit |
| Message-ID | <rYCdnRgQGaQjsZfTnZ2dnUVZ_hydnZ2d@earthlink.com> (permalink) |
| Lines | 30 |
| X-Usenet-Provider | http://www.giganews.com |
| NNTP-Posting-Host | 70.230.196.78 |
| X-Trace | sv3-n6Iu0KKY/p8EFuNA3ARJyNbWCYUS1KH/oiBe+Eoj9Ng7Ba4r1hTTQ7IHA9QH04awRa4c6By2/bHfmhj!LcmlGoCGiaNFShJigt0d9Ais0nBMXIMvmBVxKc6pDsHgwdNDzvuvG5iD/3zSuahTB9deWL/9OTvn!q07yymexIs/c3lXfHQs5ciT/2e1xtRFuhkWBypB0S5pfOA== |
| X-Abuse-and-DMCA-Info | Please be sure to forward a copy of ALL headers |
| X-Abuse-and-DMCA-Info | Otherwise we will be unable to process your complaint properly |
| X-Postfilter | 1.3.40 |
| X-Original-Bytes | 2738 |
| Xref | x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:5748 |
Show key headers only | View raw
On 6/28/2011 11:54 AM, supercalifragilisticexpialadiamaticonormalizeringelimatisticantations wrote: > On 28/06/2011 2:42 PM, Patricia Shanahan wrote: >> Each String instance has the following fields: >> >> private final char value[]; >> private final int offset; >> private final int count; >> private int hash; >> >> There are 12 bytes in addition to the char array. The offset and count >> fields allow quick sub-string construction, and hash is used to cache >> the hashCode result. > > Oh, geez, even *more* overhead. And let's not forget the array has its > own separate object header and length field! The array may be shared by several String objects. In general, many trade-offs in Java, not just the decision to make every object capable of being a lock, assume that other considerations are more important than minimizing memory use. For example, caching the hash code pays four bytes per String in order to have a hash code that depends on the entire string, without paying the cost of calculating it repeatedly when a String is used as a hash table key. If, for your purposes, minimal memory use is very important, you may want to consider other languages with other trade-offs. Patricia
Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar
Why "lock" functionality is introduced for all the objects? Alex J <vstrength@gmail.com> - 2011-06-28 02:29 -0700
Re: Why "lock" functionality is introduced for all the objects? Lew <noone@lewscanon.com> - 2011-06-28 07:33 -0400
OT "sic" (was Re: Why "lock" functionality is introduced for all the objects? blmblm@myrealbox.com <blmblm.myrealbox@gmail.com> - 2011-06-28 15:56 +0000
Re: OT "sic" (was Re: Why "lock" functionality is introduced for all the objects? Lew <noone@lewscanon.com> - 2011-06-28 12:19 -0400
Re: Why "lock" functionality is introduced for all the objects? Michal Kleczek <kleku75@gmail.com> - 2011-06-28 18:41 +0200
Re: Why "lock" functionality is introduced for all the objects? Lew <noone@lewscanon.com> - 2011-06-28 13:10 -0400
Re: Why "lock" functionality is introduced for all the objects? Michal Kleczek <kleku75@gmail.com> - 2011-06-28 19:53 +0200
Re: Why "lock" functionality is introduced for all the objects? Lew <noone@lewscanon.com> - 2011-06-28 14:13 -0400
Re: Why "lock" functionality is introduced for all the objects? supercalifragilisticexpialadiamaticonormalizeringelimatisticantations <supercalifragilisticexpialadiamaticonormalizeringelimatisticantations@averylongandannoyingdomainname.com> - 2011-06-28 14:23 -0400
Re: Why "lock" functionality is introduced for all the objects? Lew <noone@lewscanon.com> - 2011-06-28 14:33 -0400
Re: Why "lock" functionality is introduced for all the objects? supercalifragilisticexpialadiamaticonormalizeringelimatisticantations <supercalifragilisticexpialadiamaticonormalizeringelimatisticantations@averylongandannoyingdomainname.com> - 2011-06-28 14:52 -0400
Re: Why "lock" functionality is introduced for all the objects? Lew <noone@lewscanon.com> - 2011-06-28 16:20 -0400
Re: Why "lock" functionality is introduced for all the objects? supercalifragilisticexpialadiamaticonormalizeringelimatisticantations <supercalifragilisticexpialadiamaticonormalizeringelimatisticantations@averylongandannoyingdomainname.com> - 2011-06-29 00:53 -0400
Re: Why "lock" functionality is introduced for all the objects? Lew <noone@lewscanon.com> - 2011-06-29 01:04 -0400
Re: Why "lock" functionality is introduced for all the objects? supercalifragilisticexpialadiamaticonormalizeringelimatisticantations <supercalifragilisticexpialadiamaticonormalizeringelimatisticantations@averylongandannoyingdomainname.com> - 2011-06-29 01:43 -0400
Re: Why "lock" functionality is introduced for all the objects? Patricia Shanahan <pats@acm.org> - 2011-06-28 11:42 -0700
Re: Why "lock" functionality is introduced for all the objects? supercalifragilisticexpialadiamaticonormalizeringelimatisticantations <supercalifragilisticexpialadiamaticonormalizeringelimatisticantations@averylongandannoyingdomainname.com> - 2011-06-28 14:54 -0400
Re: Why "lock" functionality is introduced for all the objects? Patricia Shanahan <pats@acm.org> - 2011-06-28 12:34 -0700
Re: Why "lock" functionality is introduced for all the objects? markspace <-@.> - 2011-06-28 13:20 -0700
Re: Why "lock" functionality is introduced for all the objects? Patricia Shanahan <pats@acm.org> - 2011-06-28 13:44 -0700
Re: Why "lock" functionality is introduced for all the objects? supercalifragilisticexpialadiamaticonormalizeringelimatisticantations <supercalifragilisticexpialadiamaticonormalizeringelimatisticantations@averylongandannoyingdomainname.com> - 2011-06-29 01:05 -0400
Re: Why "lock" functionality is introduced for all the objects? Lew <noone@lewscanon.com> - 2011-06-28 16:21 -0400
Re: Why "lock" functionality is introduced for all the objects? supercalifragilisticexpialadiamaticonormalizeringelimatisticantations <supercalifragilisticexpialadiamaticonormalizeringelimatisticantations@averylongandannoyingdomainname.com> - 2011-06-29 01:06 -0400
Re: Why "lock" functionality is introduced for all the objects? BGB <cr88192@hotmail.com> - 2011-06-28 14:30 -0700
Re: Why "lock" functionality is introduced for all the objects? Robert Klemme <shortcutter@googlemail.com> - 2011-06-29 18:56 +0200
Re: Why "lock" functionality is introduced for all the objects? BGB <cr88192@hotmail.com> - 2011-06-28 13:43 -0700
Re: Why "lock" functionality is introduced for all the objects? Eric Sosman <esosman@ieee-dot-org.invalid> - 2011-06-28 20:43 -0400
Re: Why "lock" functionality is introduced for all the objects? BGB <cr88192@hotmail.com> - 2011-06-28 21:14 -0700
Re: Why "lock" functionality is introduced for all the objects? supercalifragilisticexpialadiamaticonormalizeringelimatisticantations <supercalifragilisticexpialadiamaticonormalizeringelimatisticantations@averylongandannoyingdomainname.com> - 2011-06-29 01:12 -0400
Re: Why "lock" functionality is introduced for all the objects? Joshua Maurice <joshuamaurice@gmail.com> - 2011-07-01 18:28 -0700
Re: Why "lock" functionality is introduced for all the objects? supercalifragilisticexpialadiamaticonormalizeringelimatisticantations <supercalifragilisticexpialadiamaticonormalizeringelimatisticantations@averylongandannoyingdomainname.com> - 2011-07-02 00:19 -0400
Re: Why "lock" functionality is introduced for all the objects? Joshua Cranmer <Pidgeot18@verizon.invalid> - 2011-07-01 19:05 -0700
Re: Why "lock" functionality is introduced for all the objects? supercalifragilisticexpialadiamaticonormalizeringelimatisticantations <supercalifragilisticexpialadiamaticonormalizeringelimatisticantations@averylongandannoyingdomainname.com> - 2011-07-02 00:26 -0400
Re: Why "lock" functionality is introduced for all the objects? BGB <cr88192@hotmail.com> - 2011-07-04 09:39 -0700
Re: Why "lock" functionality is introduced for all the objects? supercalifragilisticexpialadiamaticonormalizeringelimatisticantations <supercalifragilisticexpialadiamaticonormalizeringelimatisticantations@averylongandannoyingdomainname.com> - 2011-07-05 02:11 -0400
Re: Why "lock" functionality is introduced for all the objects? Alex J <vstrength@gmail.com> - 2011-07-05 16:56 -0700
Re: Why "lock" functionality is introduced for all the objects? "John B. Matthews" <nospam@nospam.invalid> - 2011-07-06 00:57 -0400
Re: Why "lock" functionality is introduced for all the objects? supercalifragilisticexpialadiamaticonormalizeringelimatisticantations <supercalifragilisticexpialadiamaticonormalizeringelimatisticantations@averylongandannoyingdomainname.com> - 2011-07-06 05:55 -0400
Re: Why "lock" functionality is introduced for all the objects? Lew <noone@lewscanon.com> - 2011-06-28 14:40 -0400
Re: Why "lock" functionality is introduced for all the objects? Robert Klemme <shortcutter@googlemail.com> - 2011-06-29 19:15 +0200
Re: Why "lock" functionality is introduced for all the objects? Tom Anderson <twic@urchin.earth.li> - 2011-06-30 23:04 +0100
Re: Why "lock" functionality is introduced for all the objects? KitKat <kitkat_11697@gmail.example.com> - 2011-06-30 18:29 -0400
Re: Why "lock" functionality is introduced for all the objects? Patricia Shanahan <pats@acm.org> - 2011-06-30 17:05 -0700
Re: Why "lock" functionality is introduced for all the objects? KitKat <kitkat_11697@gmail.example.com> - 2011-06-30 20:17 -0400
Re: Why "lock" functionality is introduced for all the objects? Tom Anderson <twic@urchin.earth.li> - 2011-07-01 21:22 +0100
Re: Why "lock" functionality is introduced for all the objects? Tom Anderson <twic@urchin.earth.li> - 2011-07-01 21:40 +0100
Re: Why "lock" functionality is introduced for all the objects? KitKat <kitkat_11697@gmail.example.com> - 2011-07-01 18:08 -0400
Re: Why "lock" functionality is introduced for all the objects? BGB <cr88192@hotmail.com> - 2011-07-05 12:15 -0700
Re: Why "lock" functionality is introduced for all the objects? KitKat <kitkat_11697@gmail.example.com> - 2011-07-05 15:30 -0400
Re: Why "lock" functionality is introduced for all the objects? blmblm@myrealbox.com <blmblm.myrealbox@gmail.com> - 2011-07-05 21:10 +0000
Re: Why "lock" functionality is introduced for all the objects? BGB <cr88192@hotmail.com> - 2011-07-05 22:08 -0700
Re: Why "lock" functionality is introduced for all the objects? KitKat <kitkat_11697@gmail.example.com> - 2011-07-06 05:57 -0400
Re: Why "lock" functionality is introduced for all the objects? blmblm@myrealbox.com <blmblm.myrealbox@gmail.com> - 2011-07-06 17:07 +0000
Re: Why "lock" functionality is introduced for all the objects? Steve Erwin <trollHunter@Usenet.4.usenetizens.org.invalid> - 2011-07-07 04:08 +1000
Re: Why "lock" functionality is introduced for all the objects? blmblm@myrealbox.com <blmblm.myrealbox@gmail.com> - 2011-07-06 19:09 +0000
Re: Why "lock" functionality is introduced for all the objects? Steve Erwin <trollHunter@Usenet.4.usenetizens.org.invalid> - 2011-07-07 09:26 +1000
Re: Why "lock" functionality is introduced for all the objects? KitKat <kitkat_11697@gmail.example.com> - 2011-07-06 20:25 -0400
Re: Why "lock" functionality is introduced for all the objects? blmblm@myrealbox.com <blmblm.myrealbox@gmail.com> - 2011-07-07 19:37 +0000
Re: Why "lock" functionality is introduced for all the objects? blmblm@myrealbox.com <blmblm.myrealbox@gmail.com> - 2011-07-07 19:35 +0000
Re: Why "lock" functionality is introduced for all the objects? Steve Erwin <trollHunter@Usenet.4.usenetizens.org.invalid> - 2011-07-07 14:34 -0700
OT names/nyms/etc. (was Re: Why "lock" functionality is introduced for all the objects?) blmblm@myrealbox.com <blmblm.myrealbox@gmail.com> - 2011-07-08 17:19 +0000
Re: OT names/nyms/etc. (was Re: Why "lock" functionality is introduced for all the objects?) Steve Erwin <trollHunter@Usenet.4.usenetizens.org.invalid> - 2011-07-09 05:41 +1000
Re: OT names/nyms/etc. (was Re: Why "lock" functionality is introduced for all the objects?) blmblm@myrealbox.com <blmblm.myrealbox@gmail.com> - 2011-07-08 19:58 +0000
Re: OT names/nyms/etc. (was Re: Why "lock" functionality is introduced for all the objects?) lewbloch <lewbloch@gmail.com> - 2011-07-08 13:45 -0700
Re: OT names/nyms/etc. (was Re: Why "lock" functionality is introduced for all the objects?) Steve Erwin <trollHunter@Usenet.4.usenetizens.org.invalid> - 2011-07-10 01:50 -0400
Re: OT names/nyms/etc. (was Re: Why "lock" functionality is introduced for all the objects?) blmblm@myrealbox.com <blmblm.myrealbox@gmail.com> - 2011-07-10 19:15 +0000
Re: OT names/nyms/etc. (was Re: Why "lock" functionality is introduced for all the objects?) KitKat <kitkat_11697@gmail.example.com> - 2011-07-10 18:38 -0400
Re: OT names/nyms/etc. (was Re: Why "lock" functionality is introduced for all the objects?) KitKat <kitkat_11697@gmail.example.com> - 2011-07-09 00:29 -0400
Re: Why "lock" functionality is introduced for all the objects? KitKat <kitkat_11697@gmail.example.com> - 2011-07-09 00:26 -0400
Re: Why "lock" functionality is introduced for all the objects? KitKat <kitkat_11697@gmail.example.com> - 2011-07-06 20:05 -0400
Re: Why "lock" functionality is introduced for all the objects? Steve Erwin <trollHunter@Usenet.4.usenetizens.org.invalid> - 2011-07-07 10:24 +1000
Re: Why "lock" functionality is introduced for all the objects? KitKat <kitkat_11697@gmail.example.com> - 2011-07-06 21:52 -0400
Re: Why "lock" functionality is introduced for all the objects? Steve Erwin <trollHunter@Usenet.4.usenetizens.org.invalid> - 2011-07-07 12:43 +1000
Re: Why "lock" functionality is introduced for all the objects? KitKat <kitkat_11697@gmail.example.com> - 2011-07-06 23:00 -0400
csiph-web