更新2:正如@Valle Lukas所指出的,看起来这是由于泄漏被解决。
更新1:
好的,我再次尝试这个,并有一个更简单的代码,以证明我遇到的问题:
my $channel=Channel.new; #create a new channel
$channel.send(0); #kickstart the circular pipeline
react {
whenever $channel {
say $_;
$channel.send($_ + 1); #send back to same pipeline
#sit back and watch the memory usage grow
}
}
基本上我通过Channel
创建一个单阶段管道,向它发送一条消息,然后设置react
/ whenever
块来处理消息(添加1)并再次将其发送回同一个通道。管道一旦开始就永不停止。
内存使用量的增长(我达到大约600MB并且在大约10秒内攀升)不是由于消息缓冲,在提示中只有一条消息。
这只是一个错误,或者我如何解决频道的内存使用问题?