garbage collecting scala actors

actor, scala

Solution

This thread on the scala-user mailing list is relevant.

There Phillip Haller mentions using a particular scheduler (available in Scala 2.8) to enable termination of an Actor before garbage collection, either on a global or per-actor basis.

Problem

Scenario: I have this code: ``` class MyActor extends Actor { def act() { react { case Message() => println("hi") } } } def meth() { val a = new MyActor a.start a ! Message() } ``` is the MyActor instance garbage collected? if not, how do i make sure it is? if I create an ad-hoc actor (with the 'actor' method), is that actor GCed?

Original source