New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Another actors memory leak? #1948
Comments
Imported From: https://issues.scala-lang.org/browse/SI-1948?orig=1 |
@phaller said: |
Alex Yakovlev (alex14n) said: import scala.actors._ object Ticket1948 { |
Alex Yakovlev (alex14n) said: |
Alex Yakovlev (alex14n) said: |
@phaller said: |
There seems to be another leak in actors. We use actors to pass large object, so any left references to messages takes tens megabytes of memory.
In Memory Analyzer report I see
scala.actors.Actor.received
as possible suspect. Not 100% sure yet, and still have no code to reproduce this bug, but looking at code:Both at the end of receive and receiveWithin there is:
val result = f(received.get)
sessions = sessions.tail
result
received
here is processed but not cleares, so I suggest adding:received = None
received
is processed only inreceive
method. Butsend
methods sets it in any case:received = Some(msg)
...
if (isSuspended)
resumeActor()
else // assert continuation != null
scheduler.execute(new Reaction(this, continuation, msg))
As far as I can understand,
received
should be set only ifisSuspended
(forreceive
).react
processes it asnew Reaction
argument. So I suggest delete this line at the beginning ofsend
method:and modify:
The text was updated successfully, but these errors were encountered: