https://kotlinlang.org logo
#konsist
Title
# konsist
p

PoisonedYouth

09/26/2023, 10:11 AM
When running on of my checks:
Copy code
@Test
    fun `no data classes use mutable properties`() {
        projectScope
            .classes()
            .withModifier(KoModifier.DATA)
            .assert {
                it.primaryConstructor?.parameters?.all { parameter ->
                    parameter.hasValModifier
                }
            }
    }

    companion object {
        val projectScope = Konsist.scopeFromProduction()
    }
I get memory problems on my Gitlab pipeline:
Copy code
Caused by: java.lang.OutOfMemoryError: Java heap space
	at java.base/java.util.Arrays.copyOfRange(Arrays.java:3821)
	at java.base/java.lang.StringLatin1.newString(StringLatin1.java:769)
	at java.base/java.lang.String.substring(String.java:2709)
	at com.intellij.psi.impl.source.CharTableImpl.createSequence(CharTableImpl.java:70)
	at com.intellij.psi.impl.source.CharTableImpl.access$600(CharTableImpl.java:16)
	at com.intellij.psi.impl.source.CharTableImpl$StringHashToCharSequencesMap.getOrAddSubSequenceWithHashCode(CharTableImpl.java:257)
	at com.intellij.psi.impl.source.CharTableImpl$StringHashToCharSequencesMap.access$200(CharTableImpl.java:202)
	at com.intellij.psi.impl.source.CharTableImpl.doIntern(CharTableImpl.java:42)
	at com.intellij.psi.impl.source.CharTableImpl.intern(CharTableImpl.java:57)
	at com.intellij.lang.impl.PsiBuilderImpl.createLeaf(PsiBuilderImpl.java:1711)
	at com.intellij.lang.impl.PsiBuilderImpl.insertLeaves(PsiBuilderImpl.java:1258)
	at com.intellij.lang.impl.PsiBuilderImpl.bind(PsiBuilderImpl.java:1207)
	at com.intellij.lang.impl.PsiBuilderImpl.buildTree(PsiBuilderImpl.java:906)
	at com.intellij.lang.impl.PsiBuilderImpl.getTreeBuilt(PsiBuilderImpl.java:892)
	at org.jetbrains.kotlin.parsing.KotlinParser.parse(KotlinParser.java:53)
	at org.jetbrains.kotlin.psi.stubs.elements.KtFileElementType.doParseContents(KtFileElementType.java:83)
	at com.intellij.psi.tree.IFileElementType.parseContents(IFileElementType.java:53)
	at com.intellij.psi.impl.source.tree.LazyParseableElement.lambda$ensureParsed$2(LazyParseableElement.java:175)
	at com.intellij.psi.impl.source.tree.LazyParseableElement$$Lambda$694/0x000000080138d318.run(Unknown Source)
	at com.intellij.psi.impl.DebugUtil.performPsiModification(DebugUtil.java:481)
	at com.intellij.psi.impl.source.tree.LazyParseableElement.ensureParsed(LazyParseableElement.java:174)
	at com.intellij.psi.impl.source.tree.LazyParseableElement.getFirstChildNode(LazyParseableElement.java:226)
	at com.intellij.psi.impl.source.tree.CompositeElement.findChildByType(CompositeElement.java:173)
	at org.jetbrains.kotlin.psi.KtFile.getPackageDirectiveByTree(KtFile.kt:85)
	at org.jetbrains.kotlin.psi.KtFile.getPackageDirective(KtFile.kt:80)
	at com.lemonappdev.konsist.core.declaration.KoFileDeclarationCore$packagee$2.invoke(KoFileDeclarationCore.kt:67)
	at com.lemonappdev.konsist.core.declaration.KoFileDeclarationCore$packagee$2.invoke(KoFileDeclarationCore.kt:66)
	at kotlin.SynchronizedLazyImpl.getValue(LazyJVM.kt:74)
	at com.lemonappdev.konsist.core.declaration.KoFileDeclarationCore.getPackagee(KoFileDeclarationCore.kt:66)
	at com.lemonappdev.konsist.core.provider.KoHasPackageProviderCore$DefaultImpls.hasPackage(KoHasPackageProviderCore.kt:18)
	at com.lemonappdev.konsist.core.declaration.KoFileDeclarationCore.hasPackage(KoFileDeclarationCore.kt:31)
	at com.lemonappdev.konsist.api.ext.list.KoHasPackageProviderListExtKt.withPackage(KoHasPackageProviderListExt.kt:30)
The project contains 5 Modules and about 30k lines of code, nothing really big. Is that a known problem? I'm using the 0.12.2 version.
i

igor.wojda

09/26/2023, 10:56 AM
Thx for reporting. This is a new one, it may not be strictly related to Konsist. I have seen this one happens with large amount of JUnit tests event when amount of memory seemed to be reasonable. We will have to investigate at some point. For now try to add these flags to
gradle.properties
Copy code
org.gradle.jvmargs=-Xms512M -Xmx4g -Dkotlin.daemon.jvm.options="-Xmx1g"
You cna also try to boost memory of the CI worker (not ideal but will work for now)
p

PoisonedYouth

09/26/2023, 11:04 AM
I solved it for now to move the test to each module separately and only check one per test.
👍 1
4 Views