You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by rm...@apache.org on 2011/05/10 03:02:20 UTC
svn commit: r1101283 -
/lucene/dev/branches/bulkpostings/lucene/src/java/org/apache/lucene/index/codecs/fixed/FixedPostingsReaderImpl.java
Author: rmuir
Date: Tue May 10 01:02:20 2011
New Revision: 1101283
URL: http://svn.apache.org/viewvc?rev=1101283&view=rev
Log:
LUCENE-3059: don't leak memory in TermState
Modified:
lucene/dev/branches/bulkpostings/lucene/src/java/org/apache/lucene/index/codecs/fixed/FixedPostingsReaderImpl.java
Modified: lucene/dev/branches/bulkpostings/lucene/src/java/org/apache/lucene/index/codecs/fixed/FixedPostingsReaderImpl.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/lucene/src/java/org/apache/lucene/index/codecs/fixed/FixedPostingsReaderImpl.java?rev=1101283&r1=1101282&r2=1101283&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/lucene/src/java/org/apache/lucene/index/codecs/fixed/FixedPostingsReaderImpl.java (original)
+++ lucene/dev/branches/bulkpostings/lucene/src/java/org/apache/lucene/index/codecs/fixed/FixedPostingsReaderImpl.java Tue May 10 01:02:20 2011
@@ -144,11 +144,8 @@ public class FixedPostingsReaderImpl ext
@Override
public Object clone() {
- FixedTermState other = (FixedTermState) super.clone();
- other.docIndex = (IntIndexInput.Index) docIndex.clone();
- if (posIndex != null) {
- other.posIndex = (IntIndexInput.Index) posIndex.clone();
- }
+ FixedTermState other = new FixedTermState();
+ other.copyFrom(this);
return other;
}
@@ -156,9 +153,19 @@ public class FixedPostingsReaderImpl ext
public void copyFrom(TermState _other) {
super.copyFrom(_other);
FixedTermState other = (FixedTermState) _other;
- docIndex.set(other.docIndex);
- if (posIndex != null && other.posIndex != null) {
- posIndex.set(other.posIndex);
+ if (docIndex == null) {
+ docIndex = (IntIndexInput.Index) other.docIndex.clone();
+ } else {
+ docIndex.set(other.docIndex);
+ }
+ if (other.posIndex != null) {
+ if (posIndex == null) {
+ posIndex = (IntIndexInput.Index) other.posIndex.clone();
+ } else {
+ posIndex.set(other.posIndex);
+ }
+ } else {
+ posIndex = null;
}
payloadFP = other.payloadFP;
skipFP = other.skipFP;