You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by "Uwe Schindler (JIRA)" <ji...@apache.org> on 2010/07/23 07:55:50 UTC

[jira] Commented: (LUCENE-2556) CharTermAttribute cloning memory consumption

    [ https://issues.apache.org/jira/browse/LUCENE-2556?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12891481#action_12891481 ] 

Uwe Schindler commented on LUCENE-2556:
---------------------------------------

{quote}
This patch optimizes the cloning of the CharTermAttributeImpl internal buffer. It keeps using clone() to clone the internal buffer when CharTermAttribute.length() is at least 150 and at least 75% and of the internal buffer length, otherwise, it uses System.arrayCopy(...) to clone it using CharTermAttribute.length() as the new internal buffer size. 
It's performing the optimization, because in some scenarios, like cloning long arrays, clone() is usually faster than System.arrayCopy(...). 
{quote}

Haven't seen your patch yet. I dont know if the two extra calculations rectify the barnching, because terms are mostly short...

If we take your patch, the allocations should in all cases be done with ArrayUtils.oversize() to be consistent with the allocation strategy of the rest of CTA.

> CharTermAttribute cloning memory consumption
> --------------------------------------------
>
>                 Key: LUCENE-2556
>                 URL: https://issues.apache.org/jira/browse/LUCENE-2556
>             Project: Lucene - Java
>          Issue Type: Improvement
>          Components: Analysis
>    Affects Versions: 3.0.2
>            Reporter: Adriano Crestani
>            Assignee: Uwe Schindler
>            Priority: Minor
>             Fix For: 3.1
>
>         Attachments: CharTermAttributeMemoryConsumptionDemo.java, LUCENE-2556.patch, lucene_2556_adriano_crestani_07_23_2010.patch
>
>
> The memory consumption problem with cloning a CharTermAttributeImpl object was raised on thread http://markmail.org/thread/bybuerugbk5w2u6z

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org