Kotlin : Uncontrolled memory allocation