Created
December 7, 2011 03:37
-
-
Save haruyama/1441337 to your computer and use it in GitHub Desktop.
lucene-gosen くよ bug
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.io.Reader; | |
import java.io.StringReader; | |
import org.apache.lucene.analysis.ja.JapaneseTokenizer; | |
public class LuceneGosenKuyoBug { | |
public static void main(String[] args) { | |
String s = ""; | |
int count = Integer.parseInt(args[1]); | |
for (int i = 0; i < count; ++i) { | |
s += args[0]; | |
} | |
System.out.println(s); | |
StringReader reader = new StringReader(s); | |
JapaneseTokenizer tokenizer = new JapaneseTokenizer(reader); | |
try { | |
while (tokenizer.incrementToken()) { | |
} | |
} catch(Throwable t) { | |
t.printStackTrace(); | |
} | |
} | |
} | |
/* | |
% java -version | |
java version "1.7.0_147-icedtea" | |
OpenJDK Runtime Environment (IcedTea7 2.0) (7~b147-2.0-1) | |
OpenJDK 64-Bit Server VM (build 21.0-b17, mixed mode) | |
% javac -cp ...../lucene-core-3.5.0.jar:...../lucene-gosen-1.2.0-ipadic.jar:. LuceneGosenKuyoBug.java | |
% time java -cp ...../lucene-core-3.5.0.jar:...../lucene-gosen-1.2.0-ipadic.jar:. LuceneGosenKuyoBug くよ 10 | |
くよくよくよくよくよくよくよくよくよくよ | |
java -cp LuceneGosenKuyoBug くよ 10 0.45s user 0.05s system 118% cpu 0.427 total | |
% time java -cp ...../lucene-core-3.5.0.jar:...../lucene-gosen-1.2.0-ipadic.jar:. LuceneGosenKuyoBug くよ 15 | |
くよくよくよくよくよくよくよくよくよくよくよくよくよくよくよ | |
java -cp LuceneGosenKuyoBug くよ 15 0.82s user 0.10s system 134% cpu 0.686 total | |
% time java -cp ...../lucene-core-3.5.0.jar:...../lucene-gosen-1.2.0-ipadic.jar:. LuceneGosenKuyoBug くよ 20 | |
くよくよくよくよくよくよくよくよくよくよくよくよくよくよくよくよくよくよくよくよ | |
java -cp LuceneGosenKuyoBug くよ 20 25.99s user 1.53s system 180% cpu 15.211 total | |
% time java -cp ...../lucene-core-3.5.0.jar:...../lucene-gosen-1.2.0-ipadic.jar:. LuceneGosenKuyoBug くよ 30 | |
くよくよくよくよくよくよくよくよくよくよくよくよくよくよくよくよくよくよくよくよくよくよくよくよくよくよくよくよくよくよ | |
Exception in thread "main" java.lang.OutOfMemoryError: Java heap space | |
at java.util.IdentityHashMap.keySet(IdentityHashMap.java:963) | |
at java.util.Collections$SetFromMap.<init>(Collections.java:3887) | |
at java.util.Collections.newSetFromMap(Collections.java:3871) | |
at java.lang.Throwable.printStackTrace(Throwable.java:648) | |
at java.lang.Throwable.printStackTrace(Throwable.java:642) | |
at java.lang.Throwable.printStackTrace(Throwable.java:633) | |
at LuceneGosenKuyoBug.main(LuceneGosenKuyoBug.java:20) | |
java -cp LuceneGosenKuyoBug くよ 30 78.00s user 2.22s system 132% cpu 1:00.62 total | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment