Permalink
Browse files

Add gc_test.

  • Loading branch information...
1 parent 0d7fe65 commit ae7c6664d75ee142377ae664fa9d26109c1cba50 @ongaeshi committed Aug 10, 2011
Showing with 14 additions and 1 deletion.
  1. +14 −1 lib/milkode/cdstk/cdstk.rb
View
@@ -27,8 +27,13 @@ class Cdstk
# 記号・アルファベット・数字もバイグラムでトークナイズする。
DEFAULT_TOKENIZER = "TokenBigramSplitSymbolAlphaDigit"
-
+
+ # コンバート時のエラー
class ConvetError < RuntimeError ; end
+
+ # gc
+ GC_COUNTER = 100
+ @@gc_counter = 0
def initialize(io = $stdout, db_dir = ".")
@db_dir = db_dir
@@ -417,6 +422,14 @@ def db_add_dir(dirname)
private :db_add_dir
def db_add_file(stdout, filename, shortpath)
+ @@gc_counter += 1
+ p @@gc_counter
+ if (@@gc_counter > GC_COUNTER)
+ puts "gc start ..."
+ GC.start
+ @@gc_counter = 0
+ end
+
# 格納するデータ
values = {
:path => filename,

0 comments on commit ae7c666

Please sign in to comment.