Garbage collecting actors and messages

Skip to first unread message

Noah Friedland

Jan 2, 2020, 6:48:02 AM1/2/20
to Akka User List
I have a pattern where I am spawning an actor to aggregate pending results from other actors for each task request. Once that actor finishes its task it is discarded. The system goes through quite a few of these so I'm concerned with possible garbage collection issues.

1. Is there an elegant way to recycle these actors, e.g. creating a pool of them and reusing them once they have completed their task?
2. Upon shutdown, are actors garbage collected? I am passing parameters to these actors via props at startup, some of which are long term objects. Do I have to set these to null in the post shutdown to make sure the actor is garbage collected?
3. How are the akka messages garbage collected? All their field values are set to final and some of them might contain references to long term objects.

Reply all
Reply to author
0 new messages