lucene-java-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From uschind...@apache.org
Subject svn commit: r1029022 - in /lucene/java/branches/lucene_3_0: CHANGES.txt src/java/org/apache/lucene/analysis/Token.java src/java/org/apache/lucene/analysis/tokenattributes/TermAttributeImpl.java
Date Sat, 30 Oct 2010 11:13:14 GMT
Author: uschindler
Date: Sat Oct 30 11:13:14 2010
New Revision: 1029022

URL: http://svn.apache.org/viewvc?rev=1029022&view=rev
Log:
LUCENE-2556: Improve memory usage after cloning TermAttribute

Modified:
    lucene/java/branches/lucene_3_0/CHANGES.txt
    lucene/java/branches/lucene_3_0/src/java/org/apache/lucene/analysis/Token.java
    lucene/java/branches/lucene_3_0/src/java/org/apache/lucene/analysis/tokenattributes/TermAttributeImpl.java
  (contents, props changed)

Modified: lucene/java/branches/lucene_3_0/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/java/branches/lucene_3_0/CHANGES.txt?rev=1029022&r1=1029021&r2=1029022&view=diff
==============================================================================
--- lucene/java/branches/lucene_3_0/CHANGES.txt (original)
+++ lucene/java/branches/lucene_3_0/CHANGES.txt Sat Oct 30 11:13:14 2010
@@ -198,6 +198,9 @@ Optimizations
 * LUCENE-2360: Small speedup to recycling of reused per-doc RAM in
   IndexWriter (Robert Muir, Mike McCandless)
 
+* LUCENE-2556: Improve memory usage after cloning TermAttribute.
+  (Adriano Crestani via Uwe Schindler)
+
 ======================= Release 3.0.1 2010-02-26 =======================
 
 Changes in backwards compatibility policy

Modified: lucene/java/branches/lucene_3_0/src/java/org/apache/lucene/analysis/Token.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/lucene_3_0/src/java/org/apache/lucene/analysis/Token.java?rev=1029022&r1=1029021&r2=1029022&view=diff
==============================================================================
--- lucene/java/branches/lucene_3_0/src/java/org/apache/lucene/analysis/Token.java (original)
+++ lucene/java/branches/lucene_3_0/src/java/org/apache/lucene/analysis/Token.java Sat Oct
30 11:13:14 2010
@@ -524,7 +524,8 @@ public class Token extends AttributeImpl
     Token t = (Token)super.clone();
     // Do a deep clone
     if (termBuffer != null) {
-      t.termBuffer = (char[]) termBuffer.clone();
+      t.termBuffer = new char[this.termLength];
+      System.arraycopy(this.termBuffer, 0, t.termBuffer, 0, this.termLength);
     }
     if (payload != null) {
       t.payload = (Payload) payload.clone();

Modified: lucene/java/branches/lucene_3_0/src/java/org/apache/lucene/analysis/tokenattributes/TermAttributeImpl.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/lucene_3_0/src/java/org/apache/lucene/analysis/tokenattributes/TermAttributeImpl.java?rev=1029022&r1=1029021&r2=1029022&view=diff
==============================================================================
--- lucene/java/branches/lucene_3_0/src/java/org/apache/lucene/analysis/tokenattributes/TermAttributeImpl.java
(original)
+++ lucene/java/branches/lucene_3_0/src/java/org/apache/lucene/analysis/tokenattributes/TermAttributeImpl.java
Sat Oct 30 11:13:14 2010
@@ -182,7 +182,8 @@ public class TermAttributeImpl extends A
     TermAttributeImpl t = (TermAttributeImpl)super.clone();
     // Do a deep clone
     if (termBuffer != null) {
-      t.termBuffer = (char[]) termBuffer.clone();
+      t.termBuffer = new char[this.termLength];
+      System.arraycopy(this.termBuffer, 0, t.termBuffer, 0, this.termLength);
     }
     return t;
   }

Propchange: lucene/java/branches/lucene_3_0/src/java/org/apache/lucene/analysis/tokenattributes/TermAttributeImpl.java
------------------------------------------------------------------------------
--- svn:mergeinfo (added)
+++ svn:mergeinfo Sat Oct 30 11:13:14 2010
@@ -0,0 +1,7 @@
+/lucene/dev/branches/branch_3x/lucene/src/java/org/apache/lucene/analysis/tokenattributes/TermAttributeImpl.java:941394,946651,948430,957490,957920,984210,988629,990286,999226,999847
+/lucene/dev/trunk/lucene/src/java/org/apache/lucene/analysis/tokenattributes/CharTermAttributeImpl.java:1024408
+/lucene/dev/trunk/lucene/src/java/org/apache/lucene/analysis/tokenattributes/TermAttributeImpl.java:929738,932398,935522,938989,939611,939649,940730,945420,946599,948082,948429,949288,949976,949997,950458,950613,951521,953407,957707,963372,963781,965103,965299,984187,989785,990281,994979,999223,999842
+/lucene/java/branches/lucene_2_4/src/java/org/apache/lucene/analysis/tokenattributes/TermAttributeImpl.java:748824
+/lucene/java/branches/lucene_2_9/src/java/org/apache/lucene/analysis/tokenattributes/TermAttributeImpl.java:817269-818600,825998,829134,829881,831036,896850,909334,940987,948516,1028833,1028850
+/lucene/java/branches/lucene_2_9_back_compat_tests/src/java/org/apache/lucene/analysis/tokenattributes/TermAttributeImpl.java:818601-821336
+/lucene/java/trunk/src/java/org/apache/lucene/analysis/tokenattributes/TermAttributeImpl.java:881213,881315,881466,881819,882374,882672,882807,882888,882977,883074-883075,883554,884870,886257,886911,887347,887532,887602,887670,888247,889431-889432,889579,889866,890439,890967,890988,891189,891205,891209,891363,891377,893093,894348,897672,899627,900196,903368,908477,908975,909360,909398,910034,910078,912407,915399,916543,919060,919869,920270



Mime
View raw message