12

I'm doing a school project on Kotlin and need to know how it deals with garbage. Is it similar to Java in its garbage collector?

Krzysztof Krasoń
  • 26,515
  • 16
  • 89
  • 115
Dina Kleper
  • 1,949
  • 4
  • 17
  • 23
  • Possible duplicate of [What is the garbage collector in Java?](http://stackoverflow.com/questions/3798424/what-is-the-garbage-collector-in-java) – miensol Jun 28 '16 at 09:25
  • 10
    It's not a duplicate till you explain that they have the same garbage collector. – Dina Kleper Jun 28 '16 at 09:31

2 Answers2

26

Kotlin is run in JVM so it uses the same garbage collector as Java or any other JVM based language.

Krzysztof Krasoń
  • 26,515
  • 16
  • 89
  • 115
9

The garbage collector depends on the settings of your JVM runtime, not the language the program is written in (Jave, Kotlin, Groovy, Scala, Ceylon, etc)

voddan
  • 31,956
  • 8
  • 77
  • 87