圆形管道占用大量内存

drc*_*law 6 memory pipeline perl6

更新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
    }
}
Run Code Online (Sandbox Code Playgroud)

基本上,我通过创建一个单级管道Channel,向其发送一条消息,然后进行设置react/ whenever块处理消息(加1),然后再次将其发送回同一通道。管道一旦启动就永远不会停止。

内存使用量的增长(我达到了约600MB,并在约10秒内攀升了),并不是由于消息缓冲,提示中只有一条消息。

这仅仅是一个错误还是我该如何解决通道的内存使用情况?

Val*_*kas 4

似乎由乔纳森·沃辛顿承诺解决

d5044de

25b486d