title: Swinject: Using weak scope is leaking objects
body: <p>I'm using Swinject for DI in my swift project. I think using weak object scope is leading to leaks.</p>
  
  <p>I have this dummy object</p>
  
  <pre><code>protocol DevTestProtocol: class {}
  class DevTest: DevTestProtocol {}
  </code></pre>
  
  <p>which is registered like follows (I'm using an assembly)</p>
  
  <pre><code>container.register(DevTestProtocol.self) { _ in
      return DevTest()
  }
  .inObjectScope(.weak)
  </code></pre>
  
  <p>For testing purposes I added a property in my app delegate</p>
  
  <pre><code>var devTest: DevTestProtocol?
  </code></pre>
  
  <p>and in applicationDidFinishLaunchingWithOptions I resolve the object then forget about it</p>
  
  <pre><code>self.devTest = DI.resolve(DevTestProtocol.self)!
  self.devTest = nil
  </code></pre>
  
  <p>Is the DevTest instance supposed to be gone by now? 
  Because it's not. It still shows in the debug memory graph as a leak.
  <a href="https://i.stack.imgur.com/Lyqxd.jpg" rel="nofollow noreferrer">see screenshot</a> </p>
  
  <p>I guess this isn't expected behaviour? Am I missing something?
  It looks like a bug to me and it's messing up my whole setup.
  What can we do about this?
  <a href="https://github.com/Swinject/Swinject/issues/256" rel="nofollow noreferrer" title="GitHub issue">GitHub issue</a></p>