When you concatenate two publishers, one of which is a merge, you will get a leak reported in Xcode’s memory graph debugger.
The publisher can be as simple as:
self.cancellable = Publishers.Concatenate(
prefix: Empty<Int, Never>(completeImmediately: true),
suffix: Publishers.MergeMany(Empty(completeImmediately: true))
)
.print()
.sink { _ in }
I have a project attached that shows the problem. Simply launch the application and open the memory graph debugger to see the leaks. The pertinent code is in the SceneDelegate.