---
title: "What do you mean by Autorelease pool - Drain Vs Release"  
description: "What do you mean by Autorelease pool - Drain Vs Release"  
author: "Anonymous User"  
published: 2015-08-11  
updated: 2020-09-23  
canonical: https://www.mindstick.com/interview/12772/what-do-you-mean-by-autorelease-pool-drain-vs-release  
category: "iphone"  
tags: ["iphone", "ios", "objective c"]  
reading_time: 1 minute  

---

# What do you mean by Autorelease pool - Drain Vs Release

**In a reference-counted environment**, drain does perform the same operations as release, so the two are in that sense equivalent. To emphasise, this means you do not leak a pool if you use drain rather than release.

**In a garbage-collected environment**, release is a no-op. Thus it has no effect. drain, on the other hand, contains a hint to the collector that it should "collect if needed". Thus in a garbage-collected environment, using drain helps the system balance collection sweeps.

## Answers

### Answer by Anonymous User

**In a reference-counted environment**, drain does perform the same operations as release, so the two are in that sense equivalent. To emphasise, this means you do not leak a pool if you use drain rather than release.

**In a garbage-collected environment**, release is a no-op. Thus it has no effect. drain, on the other hand, contains a hint to the collector that it should "collect if needed". Thus in a garbage-collected environment, using drain helps the system balance collection sweeps.


---

Original Source: https://www.mindstick.com/interview/12772/what-do-you-mean-by-autorelease-pool-drain-vs-release

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
