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(
124124 )
125125 } finally {
126126 scene.close()
127+ runGC() // cleanup for next benchmarks
127128 }
128129}
Original file line number Diff line number Diff line change 33 * Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE.txt file.
44 */
55
6- import kotlinx.coroutines.runBlocking
6+ import kotlinx.coroutines.MainScope
7+ import kotlinx.coroutines.launch
78
89fun main (args : List <String >) {
910 Args .parseArgs(args.toTypedArray())
10- runBlocking { runBenchmarks(graphicsContext = graphicsContext()) }
11+ MainScope ().launch {
12+ runBenchmarks(graphicsContext = graphicsContext())
13+ println (" Completed!" )
14+ }
1115}
Original file line number Diff line number Diff line change 11import SwiftUI
22import 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+ }
321
422@main
523struct iOSApp : App {
624 init ( ) {
25+ MemoryWarningMonitor ( )
726 Main_iosKt . main ( args: ProcessInfo . processInfo. arguments)
827 }
928
You can’t perform that action at this time.
0 commit comments