Skip to content

Latest commit

 

History

History
13 lines (10 loc) · 479 Bytes

README.md

File metadata and controls

13 lines (10 loc) · 479 Bytes

Autorelease Pool

A simple Swift implementation of an autorelease pool. Autorelease pools help manage memory in situations where objects need to be released at a later point in time. The implementation follows the basic principles of autorelease pools in Objective-C.

Usage

DispatchQueue.concurrentPerform(iterations: 10) { _ in
  var pool: AutoreleasePool? = AutoreleasePool()
  var object: AnyObject? = TestObject().autorelease()
  pool?.drain()
  pool = nil
}