LUCENE-2556: Improve memory usage after cloning CharTermAttribute

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1024408 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Uwe Schindler 2010-10-19 20:50:02 +00:00
parent 6f66858572
commit 9221bfbfab
2 changed files with 5 additions and 1 deletions

View File

@ -745,6 +745,9 @@ Optimizations
* LUCENE-2098: Improve the performance of BaseCharFilter, especially for
large documents. (Robin Wojciki, Koji Sekiguchi, Robert Muir)
* LUCENE-2556: Improve memory usage after cloning (Char)TermAttribute.
(Adriano Crestani via Uwe Schindler)
Build
* LUCENE-2124: Moved the JDK-based collation support from contrib/collation

View File

@ -203,7 +203,8 @@ public class CharTermAttributeImpl extends AttributeImpl implements CharTermAttr
public Object clone() {
CharTermAttributeImpl t = (CharTermAttributeImpl)super.clone();
// Do a deep clone
t.termBuffer = termBuffer.clone();
t.termBuffer = new char[this.termLength];
System.arraycopy(this.termBuffer, 0, t.termBuffer, 0, this.termLength);
return t;
}