Skip to content

[BUG] possible memory leak in AsyncBufferedChannel #43

Description

@lhoward

Still figuring out whether this is a bug in my code or AsyncExtensions. I'm seeing a bunch of small leaks from AsyncBufferedChannel when used by AsyncCurrentValueSubject. Note in order to aid debugging I've modified the code to use checked continuations, although I will revert this once it is fixed.

More information as I have it, just wondering if anyone else has seen this.

relates to internal bug PADL/inferno_ui#15

STACK OF 1 INSTANCE OF 'ROOT LEAK: <Swift._ContiguousArrayStorage<AsyncExtensions.AsyncBufferedChannel<SwiftOCA.OcaProperty<SwiftOCA.OcaBoundedPropertyValue<Swift.Float>>.PropertyValue<>>.Awaiting<>>>':
18  libsystem_pthread.dylib               0x19d069d28 start_wqthread + 8
17  libsystem_pthread.dylib               0x19d06afd0 _pthread_wqthread + 228
16  libdispatch.dylib                     0x19ced06b8 _dispatch_worker_thread2 + 156
15  libdispatch.dylib                     0x19cecfea8 _dispatch_root_queue_drain + 392
14  libswift_Concurrency.dylib            0x2651dc470 swift_job_runImpl(swift::Job*, swift::ExecutorRef) + 72
13  libswift_Concurrency.dylib            0x2651db2e0 swift::runJobInEstablishedExecutorContext(swift::Job*) + 436
12  ocacli                                0x100f82e38 back deployment fallback for withCheckedContinuation<A>(isolation:function:_:) + 144  /<compiler-generated>:0
11  ocacli                                0x100f82fac closure #1 in withCheckedContinuation<A>(isolation:function:_:) + 220  /<compiler-generated>:0
10  ocacli                                0x100f7d8bc closure #1 in closure #2 in AsyncBufferedChannel.next(onSuspend:) + 728  AsyncBufferedChannel.swift:182
9   ocacli                                0x100ff9610 ManagedCriticalState.withCriticalRegion<A>(_:) + 188  Locking.swift:136
8   ocacli                                0x100f306a4 $ss13ManagedBufferCsRi__rlE25withUnsafeMutablePointersyqd_0_qd_0_SpyxG_Spyq_Gtqd__YKXEqd__YKs5ErrorRd__Ri_d_0_r0_lF + 172  /<compiler-generated>:0
7   ocacli                                0x100ff977c partial apply for closure #1 in ManagedCriticalState.withCriticalRegion<A>(_:) + 52  /<compiler-generated>:0
6   ocacli                                0x100ff96e0 closure #1 in ManagedCriticalState.withCriticalRegion<A>(_:) + 124  Locking.swift:139
5   ocacli                                0x100f83000 partial apply for closure #1 in closure #1 in closure #2 in AsyncBufferedChannel.next(onSuspend:) + 44  /<compiler-generated>:0
4   ocacli                                0x100f7e0d8 closure #1 in closure #1 in closure #2 in AsyncBufferedChannel.next(onSuspend:) + 1040  AsyncBufferedChannel.swift:188
3   libswiftCore.dylib                    0x1acd63c10 _allocateUninitializedArray<A>(_:) + 144
2   libswiftCore.dylib                    0x1ad0e27b8 swift_allocObject + 64
1   libswiftCore.dylib                    0x1ad0e24cc swift_slowAlloc + 36
0   libsystem_malloc.dylib                0x19cea8adc _malloc_zone_malloc_instrumented_or_legacy + 264 
====

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions