Reputation: 7847
I'll start my saying that I'm inexperienced with Swinject.
I'm trying to figure out why Swinject.graphIdentier
instances are constantly growing in my app.
In my case when I enter a ViewController I create n instances of MyClass
.
n can be a different amount each time the screen is visited.
When I leave the view controller all instances of MyClass
are deallocated (proven by observing allocations profiler).
The thing that I don't understand is why instances of Swinject.graphIdentier
continue to grow.
Should GraphIdentifers in swinject ever be cleanedup and if so how can I do that?
Below is a stripped down, contrived example of my code.
class MyClass {
}
container.register(MyClass.self) {_ in
return MyClass()
}
//Graph Identifier Count goes up
func addItems() {
let newItem = AppAssembler.resolver.resolve(MyClass.self)
items.append(newItem)
}
//Graph Identifier count never goes down
func removeItems() {
items.removeAll()
}
Upvotes: 1
Views: 66