LUCENE-4252: null these out for GC to close ram leak

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1365450 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Robert Muir 2012-07-25 05:26:37 +00:00
parent de8e3661fc
commit bc5848f7dc
6 changed files with 22 additions and 2 deletions

View File

@ -30,6 +30,7 @@ import org.apache.lucene.analysis.Tokenizer;
import org.apache.lucene.analysis.core.KeywordTokenizer;
import org.apache.lucene.analysis.miscellaneous.KeywordMarkerFilter;
import org.apache.lucene.analysis.util.CharArraySet;
import org.junit.AfterClass;
import org.junit.BeforeClass;
public class HunspellStemFilterTest extends BaseTokenStreamTestCase {
@ -39,6 +40,10 @@ public class HunspellStemFilterTest extends BaseTokenStreamTestCase {
public static void beforeClass() throws IOException, ParseException {
DICTIONARY = createDict(true);
}
@AfterClass
public static void afterClass() {
DICTIONARY = null;
}
public static HunspellDictionary createDict(boolean ignoreCase) throws IOException, ParseException {
InputStream affixStream = HunspellStemmerTest.class.getResourceAsStream("test.aff");
InputStream dictStream = HunspellStemmerTest.class.getResourceAsStream("test.dic");

View File

@ -19,6 +19,7 @@ package org.apache.lucene.analysis.hunspell;
import org.apache.lucene.util.LuceneTestCase;
import org.apache.lucene.util.Version;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
@ -37,6 +38,11 @@ public class HunspellStemmerTest extends LuceneTestCase {
public static void beforeClass() throws IOException, ParseException {
createStemmer(true);
}
@AfterClass
public static void afterClass() {
stemmer = null;
}
@Test
public void testStem_simpleSuffix() {

View File

@ -96,7 +96,7 @@ public class TestBasics extends LuceneTestCase {
}
}
static final Analyzer simplePayloadAnalyzer = new Analyzer() {
static Analyzer simplePayloadAnalyzer = new Analyzer() {
@Override
public TokenStreamComponents createComponents(String fieldName, Reader reader) {
@ -130,6 +130,7 @@ public class TestBasics extends LuceneTestCase {
searcher = null;
reader = null;
directory = null;
simplePayloadAnalyzer = null;
}
@Test

View File

@ -56,6 +56,7 @@ public class TestHighFreqTerms extends LuceneTestCase {
dir.close();
dir = null;
reader = null;
writer = null;
}
/******************** Tests for getHighFreqTerms **********************************/

View File

@ -48,7 +48,8 @@ public class TestMultiCoreConfBootstrap extends SolrTestCaseJ4 {
@AfterClass
public static void afterClass() {
zkServer = null;
zkDir = null;
}
@Override

View File

@ -21,6 +21,7 @@ import org.apache.lucene.queryparser.classic.ParseException;
import org.apache.lucene.search.Query;
import org.apache.lucene.search.QueryUtils;
import org.apache.solr.SolrTestCaseJ4;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
@ -34,6 +35,11 @@ public class TestValueSourceCache extends SolrTestCaseJ4 {
}
static QParser _func;
@AfterClass
public static void afterClass() throws Exception {
_func = null;
}
Query getQuery(String query) throws ParseException {
_func.setString(query);