https://kotlinlang.org logo
Title
a

Anatame

10/06/2021, 6:44 PM
Hey guys, I was planning to work a project with desktop compose. But unfortunately, when I tried the default Intellij template for desktop compose, I faced some serious memory issues. It had only one default button, nothing else. But every click on the button increases the memory usage in the task manager. Every click shoots up the memory usage. And it stays up. A simple hello button app was taking down 250MB memory after few clicks. It started with around 140MB.
j

jim

10/06/2021, 6:48 PM
I'm not positive, but I think maybe the intellij template uses a really old build of Compose? Can you try with this project: https://github.com/JetBrains/compose-jb/tree/master/templates/desktop-template and let me know if you encounter the same issue?
a

Anatame

10/06/2021, 6:50 PM
Hey Jim, Sure, I'll try doing this once I reach home. I'll update you on this.
o

olonho

10/06/2021, 7:01 PM
see https://github.com/JetBrains/compose-jb/tags for list of available builds
k

kevindmoore

10/06/2021, 8:34 PM
Last time I created one with Intelij, it was pretty old. I ended up creating a project in Android Studio (with the Multiplatform plugin) and then just added desktop compose manually
a

Anatame

10/06/2021, 10:57 PM
@jim I updated intellij to the latest version today. The compose version the default project uses is
1.0.0-alpha3
I'm getting this much cpu and memory usage https://gfycat.com/FlawlessGeneralGenet Now, the memory doesn't keep infinetly increasing with the new plugin. But is that much cpu and memory usage normal for an app with only one button with some ripple effect?
Entire discord desktop app takes like 490MBs and it's running on electron.
j

jim

10/06/2021, 11:37 PM
To be clear, you updated the intellij version or the compose version? Just want to confirm you are using compose
1.0.0-alpha4-build385
?
a

Anatame

10/06/2021, 11:43 PM
@jim Updated the intellij version and the template it's using got updated too (I created a new project with the new template). The version of compose is the latest stable release version.
1.0.0-alpha3
j

jim

10/06/2021, 11:49 PM
I would recommend trying with the latest build (ie.
1.0.0-alpha4-build385
). The last alpha3 release is rather old, and isn't much more stable than the dev builds (it is alpha, after all). The dev build is probably much closer to what will eventually be a beta build and I imagine you will have a better user experience with it. In particular, I seem to recall it having some CPU/memory fixes, so I'm wondering if it will measure better in your tests. Would be curious to hear if that performs better. That's what I was suggesting when I suggested using the linked template from the compose-jb repository and when Nikolay linked the latest versions page.
a

Anatame

10/06/2021, 11:57 PM
@jim I was just trying the latest build
kotlin("jvm") version "1.5.31"
id("org.jetbrains.compose") version "1.0.0-alpha4-build385"
But memory and cpu usage is exactly same. No significant improvement.
i

Igor Demin

10/07/2021, 12:38 AM
The high CPU usage is a bug, and it is already fixed, but there still no "stable" build with the fix, only intermediate (0.0.0-sync-2010-10-01-build378)
o

olonho

10/07/2021, 5:12 AM
Note, that there’s no linear corrrelation between number of buttons and consumed memory
a

Anatame

10/07/2021, 7:03 AM
@Igor Demin the build
1.0.0-alpha4-build385
showed no improvement in memory or CPU usage unfortunately. If anything, I actually noticed the CPU usage even higher in the latest alpha build compared to alpha 3. The usage went up to 40% and higher at times.
i

Igor Demin

10/07/2021, 7:32 AM
1.0.0-build385 doesn't contain the fix. build 0.0.0-sync-2010-10-01-build378 does
a

Anatame

10/07/2021, 7:41 AM
Lemme try this.
@Igor Demin Omg the performance on
0.0.0-sync-2010-10-01-build378
is amazing!!!!!!!
CPU and Memory usages both are lower compared to other builds.
🎉 3
Darn I'm so happy rn lollll
🙂 3
i

Igor Demin

10/07/2021, 8:00 AM
soon the fix will be in the usual builds of "1.0.0-alpha4"
a

Anatame

10/07/2021, 8:01 AM
Ye, thank you so much guys. I can finally continue on my project.