To make it short it is really easy to create a retain cycle on iOS that will prevent proxies from being deallocated, thus creating huge memory leaks
Very simple example:
This won't create a retain cycle
This will (example 1)
Same as this (example 2)
You can simply test it by adding a breakpoint in TiWindowProxy dealloc method.
You will break in the first example after clicking the window. You won't in the second and third
The reason is actually pretty simple:
- example1 : the top context holds a reference to testMe
testMe's context holds a reference to win.
Thus win can't be dealloc, then testMe can't be dealloc ....
- example2:win holds a reference to testMe. testMe's context holds a reference to win. => retain cycle
Those 2 examples simply a very important retain cycle in the SDK.
This should be handled to prevent such things.
I have been wrapping my head around this one but it's not easy to fix