presentedviewcontrollers memory leak

I have a single window utility app for OS X written using storyboards in Swift, Xcode 6. I have some helper windows which are presented modally with segues. These are dismissed using dismissViewController(self). However, the dismissed view controller is never deallocated due to the presentedViewControllers property of my root view controller, which maintains a reference. In addition, each time a helper window is reopened, a new instance of the associated view controller is created rather than the previous instance, resulting in multiple instances and a memory leak.


How can a dismissed view controller be deallocated?

Replies

dismissController(self)


instead of dismissViewController(self)


results in the dismissed view controller being deallocated.


I don't know why.