Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Scala actor memory leaks, are they as bad as It was or improving?

I am currently studding Scala 2.8 using Programming in Scala 2nd edition.

But I am beginning to get really concerned about posts like this Clojure vs Scala

Is Scala this bad about memory leaks, this is not the first info I heard about issues with actors and memory leaks.

Is it that bad? are new versions fixing it in reasonable time? Is Akka going to solve all of it if or when if it's merged?

Because seeing big issues with one of scala biggest strong points (at least for me Erlang like actors are one of the major candies of the lang) is really a major drawback if they are not being able to fix them and improve on top of it.

like image 217
Cristiano Fontes Avatar asked Dec 17 '22 09:12

Cristiano Fontes


2 Answers

I know of people using huge numbers of actors, so I'm pretty sure memory leaks are not widespread.

Did Scala Actors have memory leaks back in 2009 (Scala 2.7.x)? Yes, they did. For example, SI-1801 and SI-1948.

Right now, there are three tickets open on memory leaks that I could find: SI-3467,SI-3920 and SI-3921.

I do take issue with one comment you made, however:

one of scala biggest strong points (at least for me Erlang like actors are one of the major candies of the lang)

Actors are NOT part of the language! They are a library! That is the whole point of Scala, it is the very meaning of "scalable" from which the name Scala came: that you can add stuff like this through libraries.

There are, right now, four different actor implementations in Scala: main library, Scalaz, Lift and Akka. There's absolutely no reason for you to tie yourself to the standard library one. In fact, one of the problems with the actors in the main library is that they were written more to prove that one could do it than to solve real problems.

If you want to use actors, use Akka. You can use it right now. Hell, you can even use it with Java, if you're into syntactic masochism. Akka is a superb library, which goes far beyond simply providing actors, and into providing all the supporting tool to make them useful (like supervisors and load balancers), plus other tools to fully support concurrency, like Agents (Clojure-style), STM (Multiverse-based), integration with Spring, Camel, AMQP, etc.

Scala's strength is making it possible to seemingly extend it through libraries. If you limit yourself to what's on the standard library, you are throwing that away.

like image 184
Daniel C. Sobral Avatar answered Feb 15 '23 09:02

Daniel C. Sobral


You should try Akka. It's really robust, lightweight and tunable. For instance, you can bound mailbox sizes (and choose what to do when mailboxes are full).

like image 42
paradigmatic Avatar answered Feb 15 '23 10:02

paradigmatic