Akka Actor 内存泄漏或管理 [英] Akka Actor Memory Leak or Management
问题描述
您对 akka actor 内存管理/泄漏有任何经验吗?这里我有一个模块使用 akka actor 与其他模块通信,但随着时间的推移,由于堆内存大小,其中一个模块出现故障.
do you have any experience with akka actor memory management/leak. Here I have a module use akka actor to communicate with other modules, but as time goes by one of module went down, because of heap memory size.
完成后需要给童星送毒丸吗?因为每一个请求,我都想做另一个演员,每一个请求.童星如果也有自己的童星,还需要再送毒丸吗?
Is it necessary to send poison pill to children actor after it finished? Because every request in, I'd like to make another actor, each request. Is it necessary to send poison pill again in children actor, if they have their own children actor also?
ps:我使用的是 Scala Akka
ps: I'm using Scala Akka
谢谢
推荐答案
是的,您创建的每个 Actor 都需要明确停止.这通常是通过从 Actor 内部调用 context.stop(self)
来完成的(如果它可以确定它已完成其任务)或让主管使用 context.stop(孩子)
.
Yes, every Actor you create needs to be stopped explicitly. This is typically done by calling context.stop(self)
from within the Actor (if it can determine that it is finished with its task) or having the supervisor stop it using context.stop(child)
.
这篇关于Akka Actor 内存泄漏或管理的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!