File tree Expand file tree Collapse file tree 3 files changed +26
-2
lines changed Expand file tree Collapse file tree 3 files changed +26
-2
lines changed Original file line number Diff line number Diff line change @@ -124,5 +124,6 @@ suspend fun measureComposable(
124
124
)
125
125
} finally {
126
126
scene.close()
127
+ runGC() // cleanup for next benchmarks
127
128
}
128
129
}
Original file line number Diff line number Diff line change 3
3
* Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE.txt file.
4
4
*/
5
5
6
- import kotlinx.coroutines.runBlocking
6
+ import kotlinx.coroutines.MainScope
7
+ import kotlinx.coroutines.launch
7
8
8
9
fun main (args : List <String >) {
9
10
Args .parseArgs(args.toTypedArray())
10
- runBlocking { runBenchmarks(graphicsContext = graphicsContext()) }
11
+ MainScope ().launch {
12
+ runBenchmarks(graphicsContext = graphicsContext())
13
+ println (" Completed!" )
14
+ }
11
15
}
Original file line number Diff line number Diff line change 1
1
import SwiftUI
2
2
import benchmarks
3
+ import Combine
4
+
5
+ class MemoryWarningMonitor : ObservableObject {
6
+ private var cancellable : AnyCancellable ?
7
+
8
+ init ( ) {
9
+ self . cancellable = NotificationCenter . default
10
+ . publisher ( for: UIApplication . didReceiveMemoryWarningNotification)
11
+ . sink { _ in
12
+ self . didReceiveMemoryWarning ( )
13
+ }
14
+ }
15
+
16
+ private func didReceiveMemoryWarning( ) {
17
+ // print("Memory warning received! Cleaning resources.")
18
+ RunGC_nativeKt . runGC ( )
19
+ }
20
+ }
3
21
4
22
@main
5
23
struct iOSApp : App {
6
24
init ( ) {
25
+ MemoryWarningMonitor ( )
7
26
Main_iosKt . main ( args: ProcessInfo . processInfo. arguments)
8
27
}
9
28
You can’t perform that action at this time.
0 commit comments