15

I've started reading about the Elixir programming language.

I understand that:

  1. It is Functional
  2. It is dynamic but support @spec
  3. It is based on Erlang VM

My question is: Does it have a sort of GC?

Gian Lorenzo Meocci
  • 1,136
  • 2
  • 14
  • 23
  • 1
    Side note: `@spec`s are **annotations**, they're not understood by the Elixir compiler (or the Erlang one). They're mainly used by a static analyzer called [dialyzer](http://www.erlang.org/doc/man/dialyzer.html). – whatyouhide Apr 20 '15 at 19:52
  • for example ... if a get a list of strings from network and then I consume it in a pure function what happens when the function return? Are this list destroyed immediatly or is destroyed by a sort of GC? – Gian Lorenzo Meocci Apr 20 '15 at 20:28

1 Answers1

23

Yes, Erlang has GC, and since Elixir is built on Erlang it too has GC. See this old SO answer about Erlang GC and this one. The Elixir site refers to GC as follows:

Due to their lightweight nature, it is not uncommon to have hundreds of thousands of processes running concurrently in the same machine. Isolation allows processes to be garbage collected independently, reducing system-wide pauses, and using all machine resources as efficiently as possible (vertical scaling).

Community
  • 1
  • 1
Chase
  • 2,748
  • 2
  • 23
  • 32
  • 16
    also in elixir you can visualise the garbage as it is being collected if you start up :observer.start() and watch the graphs as your program is running. – GavinBrelstaff Apr 20 '15 at 20:49