Using recursion without its hassels

Hi

We all know how recursion can simplify code.It gives further more control when used through blocks
But the disadvantage of recursion is the memory keeps piling up till the very end. recently i implemented recursion using blocks in an iOS project but i placed the call to the function in performselectorinbackground    the result was as expected memory was not piling up.

Image 1 Memory allocation without background dispatch

Image 2 Memory allocation with background dispatch.
A pat on the back !!