0

What is the best practice regarding actors in the system -

If there is an actor that I know is now longer used and won't receive any messages - should I stop it of is it okay to keep him in the system resource wise?

Vitali Melamud
  • 1,267
  • 17
  • 40
  • `actorRef ! PoisonPill` - it kills all actors created by your actor. See http://stackoverflow.com/q/13847963/651140 – Andrzej Jozwik Jan 31 '17 at 15:03
  • 1
    There's absolutely no problem in having a lot of actors since they are very lightweight. When I say a lot, I mean even millions. If you really need to kill it, just send appropriate message and use `context.stop(self)` / `context().stop(getSelf());`. I wouldn't use `PoisonPill` since it's... too easy. :) – Branislav Lazic Jan 31 '17 at 17:00
  • @BranislavLazic, there is a problem having a lot of actors, because the actors will not be garbage collected and you may end with a memory leak – Pedro Ghilardi Feb 24 '17 at 13:40

0 Answers0