pointfreeco / swift-composable-architecture

A library for building applications in a consistent and understandable way, with composition, testing, and ergonomics in mind.
https://www.pointfree.co/collections/composable-architecture
MIT License
12.07k stars 1.41k forks source link

NSLock Memory leaks #3103

Closed Slobodianiuk95 closed 3 months ago

Slobodianiuk95 commented 3 months ago

Description

Hello! I discovered memory leaks using the Leaks tool while developing my own application. At first, I thought it was my mistake, but then I found the same memory leaks in the Todos and VoiceMemos examples. This happens from the start of the application and increases as it is used.

CleanShot 2024-05-20 at 13 15 47@2x

Checklist

Expected behavior

No leaks happend

Actual behavior

NSLock leaks in Xcode -> Instruments -> Leaks

Steps to reproduce

  1. Open any example app like Todos
  2. Install app on device or simulator
  3. Open Xcode -> Instruments -> Leaks and start recording Todos app session

The Composable Architecture version information

1.10.4

Destination operating system

iOS 17.5

Xcode version information

Xcode 15.4

Swift Compiler version information

swift-driver version: 1.90.11.1 Apple Swift version 5.10 (swiftlang-5.10.0.13 clang-1500.3.9.4)
Target: arm64-apple-macosx14.0
mbrandonw commented 3 months ago

Hi @Slobodianiuk95, this lock is only used in #if DEBUG code and so the leak does not happen when building in release mode.

Since this is not an issue with the library I am going to convert it to a discussion. Feel free to continue the conversation over there!