https://kotlinlang.org logo
#compose
Title
# compose
s

semoro

04/08/2020, 12:02 PM
I expirence some performance problems related to
@Preview
in Android Studio 4.1 Canary 4 There is some freezes on typing, which is caused by
@Preview
annotation discovery, I have thread dumps for it Also, there is some memory leak happens, as after few hours of work AS consumes 4-5 Gb of RAM, can provide heap analysis dump
5
1. Memory leaks There are a lot of some disposal exceptions, which could be related, thrown every time I hit refresh button in preview
Copy code
2020-04-01 23:31:32,301 [4536717]  ERROR - ea.rendering.LayoutlibCallback - Error while disposing a RenderSession 
java.lang.IllegalStateException: Node should be attached to an owner
	at androidx.ui.core.ComponentNodesKt.requireOwner(ComponentNodes.kt:1734)
	at androidx.ui.core.AndroidComposeView.requestRelayout(AndroidOwner.kt:289)
	at androidx.ui.core.AndroidComposeView.access$requestRelayout$0(AndroidOwner.kt)
	at androidx.ui.core.AndroidComposeView$onCommitAffectingLayout$1.invoke(AndroidOwner.kt:156)
	at androidx.ui.core.AndroidComposeView$onCommitAffectingLayout$1.invoke(AndroidOwner.kt)
	at androidx.ui.core.ModelObserver$CommitMap.callOnCommit(ModelObserver.kt:240)
	at androidx.ui.core.ModelObserver.callOnCommit(ModelObserver.kt:204)
	at androidx.ui.core.ModelObserver.access$callOnCommit$2(ModelObserver.kt)
	at androidx.ui.core.ModelObserver$commitObserver$1$1.invoke(ModelObserver.kt:59)
	at androidx.ui.core.ModelObserver$commitObserver$1$1.invoke(ModelObserver.kt)
	at androidx.ui.core.AndroidOwnerKt$sam$java_lang_Runnable$0.run(AndroidOwner.kt)
	at android.os.Handler_Delegate.dispose(Handler_Delegate.java:132)
	at com.android.layoutlib.bridge.impl.RenderSessionImpl.dispose(RenderSessionImpl.java:1188)
	at com.android.layoutlib.bridge.BridgeRenderSession.dispose(BridgeRenderSession.java:205)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at java.lang.Thread.run(Thread.java:748)
2. Freezes
1. Memory leaks Analyze memory not working for me, with some cryptic Swing exceptions, but in hprof I see a lot of
com.android.layoutlib.bridge.android.BridgeContext
If you need .hprof, I could upload it to GDrive
It is just single object path, while I have 49 of them with almost same path
c

caelum19

04/09/2020, 8:27 PM
You still getting these on canary 5?
I am not but I never actually installed canary 4 so maybe I wasn't getting them then either
k

Kazemihabib1996

04/12/2020, 12:58 PM
Canary 4 used to crash every 15-20 minutes for me, I'm using Canary 5 for hours, still without crash. (Windows 10)
s

semoro

04/14/2020, 5:20 PM
Sure, because there are still same code
n

nosuid

04/14/2020, 5:54 PM
hey, yes, thanks for lettings us know. We are aware of the memory issues cause by the interaction of the Preview with some of the Compose code and we are working through them. For the freezes, we did some small fixes but need to rewrite a bit of the code for the annotation finding.
c

caelum19

05/23/2020, 7:26 PM
Out of curiosity, are you guys using Android studio for your own testing? Is there a less elegant solution without the freezes ? 😄
👍 1