diff --git a/kotlin-native/backend.native/tests/interop/objc/tests/workerAutoreleasePool.m b/kotlin-native/backend.native/tests/interop/objc/tests/workerAutoreleasePool.m index 5fa2797d994..24de2a771ea 100644 --- a/kotlin-native/backend.native/tests/interop/objc/tests/workerAutoreleasePool.m +++ b/kotlin-native/backend.native/tests/interop/objc/tests/workerAutoreleasePool.m @@ -6,14 +6,12 @@ @implementation CreateAutorelease { CreateAutoreleaseDeallocated* deallocated; } -+(instancetype)create:(CreateAutoreleaseDeallocated*)deallocated { - CreateAutorelease* result = [self new]; - result->deallocated = deallocated; - return result; -} +(void)createAutorelease:(CreateAutoreleaseDeallocated*)deallocated { - [self create:deallocated]; + // __autoreleasing attribute prevents from early deallocation + // and thus makes test behaviour identical on Intel and ARM CPUs. + __autoreleasing CreateAutorelease* result = [self new]; + result->deallocated = deallocated; } -(void)dealloc {