Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!news.albasani.net!.POSTED!not-for-mail From: Lew Newsgroups: comp.lang.java.programmer Subject: Re: Why "lock" functionality is introduced for all the objects? Date: Tue, 28 Jun 2011 16:21:39 -0400 Organization: albasani.net Lines: 23 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Trace: news.albasani.net OjuSA2/XKdPkik8veYd+fn2HTaa+RDiLdoq7ZDeAjZ5Ejz3mO9rJ6OGxeQUw59ZbEjLON8sIX8qW94W68yXM9lxv3b4XlHh4iw83yekYSP8XOa8ctyytjVU/ibFdQ4lr NNTP-Posting-Date: Tue, 28 Jun 2011 20:21:38 +0000 (UTC) Injection-Info: news.albasani.net; logging-data="po83YGUeP9aq8hBripp9KbmpA19Ivpd5XoUSKIF+mV5NPrVDVnZ3eKcrHa3XG1uIlIBcJnLYs/AQyDME6LS4q6tSaxpmU+eZ7AStP4nusoI0bnmaq1D/FHV9vEtR/HgR"; mail-complaints-to="abuse@albasani.net" User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.17) Gecko/20110424 Thunderbird/3.1.10 In-Reply-To: Cancel-Lock: sha1:pJuY0UK5d2BYYMrTY2M7rs58URM= Xref: x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:5751 On 06/28/2011 02:54 PM, 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! Much less than 50% of the object size here is for monitors. -- Lew Honi soit qui mal y pense. http://upload.wikimedia.org/wikipedia/commons/c/cf/Friz.jpg