File tree 2 files changed +26
-0
lines changed
2 files changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -168,6 +168,7 @@ kotlin.sourceSets {
168
168
api " org.jetbrains.kotlinx:lincheck:$lincheck_version "
169
169
api " org.jetbrains.kotlinx:kotlinx-knit-test:$knit_version "
170
170
implementation project(" :android-unit-tests" )
171
+ implementation " org.openjdk.jol:jol-core:0.16"
171
172
}
172
173
}
173
174
Original file line number Diff line number Diff line change
1
+ /*
2
+ * Copyright 2016-2022 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
3
+ */
4
+
5
+ package kotlinx.coroutines
6
+
7
+ import org.junit.Test
8
+ import org.openjdk.jol.info.ClassLayout
9
+ import kotlin.test.*
10
+
11
+
12
+ class MemoryFootprintTest : TestBase (true ) {
13
+
14
+ @Test
15
+ fun testJobLayout () = assertLayout(Job ().javaClass, 24 )
16
+
17
+ @Test
18
+ fun testCancellableContinuationFootprint () = assertLayout(CancellableContinuationImpl ::class .java, 48 )
19
+
20
+ private fun assertLayout (clz : Class <* >, expectedSize : Int ) {
21
+ val size = ClassLayout .parseClass(clz).instanceSize()
22
+ // println(ClassLayout.parseClass(clz).toPrintable())
23
+ assertEquals(expectedSize.toLong(), size)
24
+ }
25
+ }
You can’t perform that action at this time.
0 commit comments