I'm creating an autorelease pool in a for loop (in method A). At each iteration of the loop, I'm calling another method (method B). Method B returns an autoreleased object to Method A. If I drain the pool within the for loop in Method A, will that release the objects sent from Method B?
Thanks!
Yes - any time an object is sent -autorelease
, it's added to the highest level autorelease pool. As long as you aren't creating any new autorelease pools in method B or further down the call stack, method A's pool should be the highest level pool.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With