Concurrent Clean : Heap Full (1)

[id:lethevert:20060217:p1]や[id:lethevert:20060215:p2]で困っているHeap Fullですが、以下のコードで再現することを確認しました。

import StdEnv
Start = [0..]!!100000

環境は、以下。

OS : Windows 2000 Professional
Clean : 2.1.1 (英語版と日本語化版の両方)
Maximam Heap Size : 400K
Stack Size : 100K

どうも、GCがきちんと動作していないみたい。

      • -

[id:lethevert:20060215:p2]の実行完了したものとしなかったもののABCファイルを見比べてみたところ、ソースコードには1行しか差がないのに、ABCコードには結構差があった。たとえば、
実行完了したもの

s13
	buildB TRUE
	pushI 0
	pushI 0
	pushI 0
	push_a 1
	update_a 1 2
	updatepop_a 0 1

Heap Fullになったもの

s13
	buildB TRUE
	buildI 0
	buildI 0
	buildI 0
	push_a 4
	update_a 4 5
	update_a 3 4
	update_a 2 3
	update_a 1 2
	updatepop_a 0 1

という部分があった。全体的に、Heap Fullになった方は、build命令が多く、実行完了した方は、そこがpush命令になっているようだ。

      • -

以下のコードはHeap Fullとなった。

estimate_pi2 trials = estimate 0.0 0.0 trials 0
  where
    estimate x y 0 r = (x/y, r)
    estimate x y trials r
        = estimate (x+1.0) (y+1.0) (trials-1) r

しかし、以下のコードは実行完了した。

estimate_pi2 trials = estimate 0.0 0.0 trials 0
  where
    estimate :: !Real !Real !Int !Int -> (!Real, !Int)
    estimate x y 0 r = (x/y, r)
    estimate x y trials r
        = estimate (x+1.0) (y+1.0) (trials-1) r

正格性解析の問題かもしれない。