Skip to content

Is async macro leaking? #265

Open
scala/scala
#10783
@hurlebouc

Description

@hurlebouc

Hi,

when you run code

object Main {

implicit val syncExecutor : ExecutionContext = new ExecutionContext {
    override def execute(runnable: Runnable): Unit = runnable.run()

    override def reportFailure(cause: Throwable): Unit = throw cause
  }

  def stop : Unit = {
    Thread.sleep(60000)
    println("stop")
  }

  class Witness

  def main(args: Array[String]): Unit = {
    async{
      await(Future{new Witness})
      stop
    }
  }
}

and then, during the sleep, you take a heap dump with VisualVM, you see that there is still an object of type Witness in the heap. Is this normal?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions