I'm working on a Producer-consumer problem with an unbounded consumer. The producer can put as many tasks into the processing queue as it wants. When the queue is empty the consumer will block the thread.
while true {
do {
guard let job = try self.queue.dequeue() else { return }
job.perform()
} catch {
print(error)
}
}
Normally I would put everything in the loop in an autorelease pool, however, it's not available on Linux. It seems as though ARC is never releasing the objects in the loop. How should I go about controlling memory usage?