Android 4.2 out of memory error after update

Viewed 134

I have one function (probably more) that makes the studio freeze and throw an "Out of memory" error. I have changed on all places to 4096m memory. (Vm options, and Android studio memory settings, also in project.)

When I try to add a parameter to the function below my studio freeze after I have typed in two letters. The function that makes Android studio freeze is:

fun createCard(
            card: FuelCardEntity,
            hotLineNumber: String? = null
        ) = CardData(
            title = R.string.title,
            preTitle = R.string.subtitle,
            itemTitle = R.string.message_title,
            itemSubTitle = hotLineNumber ?: "",
            itemIcon = R.drawable.ic_ico_call,
            bodyTitle = R.string.notice_subtitle,
            body = R.string.notice_body,
            buttonText = R.string.mycard_button,
            fuelCard = DialogFuelCard(
                title = R.string.title,
                logoLeft = R.drawable.ic_logo,
                logoCenter = R.drawable.full_logo,
                logoEndTop = R.drawable.ic_logo_card,
                validInText = R.string.mycard_validin,
                validInCountryText = card.CountryName,
                fleet = fuelCard.organisationName,
                validUntilText = R.string.mycard_card_validthrough,
                validUntilDate = "${card.expiryMonth}/${card.expiryYear.substring(2)}",
                organisationTitle = R.string.organisation,
                cardNumber = fuelCard.cardNumber
            )
        )

If I change the function to have a body instead it works and does not freeze.

  fun createCard(
          card: FuelCardEntity,
          hotLineNumber: String? = null
    ) {
          return CardData(...)
    }

This happened after update to Android 4.2 and kotlin version 1.4.32

What's the difference between having a body and just having a "=" ? And why is it consuming more memory?

Out of memory error image

0 Answers
Related