Skip to content
This repository
Browse code

Add gc_test.

  • Loading branch information...
commit ae7c6664d75ee142377ae664fa9d26109c1cba50 1 parent 0d7fe65
ongaeshi authored

Showing 1 changed file with 14 additions and 1 deletion. Show diff stats Hide diff stats

  1. +14 1 lib/milkode/cdstk/cdstk.rb
15 lib/milkode/cdstk/cdstk.rb
@@ -27,8 +27,13 @@ class Cdstk
27 27
28 28 # 記号・アルファベット・数字もバイグラムでトークナイズする。
29 29 DEFAULT_TOKENIZER = "TokenBigramSplitSymbolAlphaDigit"
30   -
  30 +
  31 + # コンバート時のエラー
31 32 class ConvetError < RuntimeError ; end
  33 +
  34 + # gc
  35 + GC_COUNTER = 100
  36 + @@gc_counter = 0
32 37
33 38 def initialize(io = $stdout, db_dir = ".")
34 39 @db_dir = db_dir
@@ -417,6 +422,14 @@ def db_add_dir(dirname)
417 422 private :db_add_dir
418 423
419 424 def db_add_file(stdout, filename, shortpath)
  425 + @@gc_counter += 1
  426 + p @@gc_counter
  427 + if (@@gc_counter > GC_COUNTER)
  428 + puts "gc start ..."
  429 + GC.start
  430 + @@gc_counter = 0
  431 + end
  432 +
420 433 # 格納するデータ
421 434 values = {
422 435 :path => filename,

0 comments on commit ae7c666

Please sign in to comment.
Something went wrong with that request. Please try again.