Skip to content

Instantly share code, notes, and snippets.

@zhongge
Created December 14, 2014 11:31
Show Gist options
  • Save zhongge/f0bf5a7e7200e74f2fe9 to your computer and use it in GitHub Desktop.
Save zhongge/f0bf5a7e7200e74f2fe9 to your computer and use it in GitHub Desktop.
What is the bug in this code and what is the consequence?
There is no bug in compile. But It has memory leaks. Because of child.parent = parent when TTChild's @property (automic) TTParent *parent;
How to fix?
As a way of fixing, you can change the TTChild's parent property.
@property (atomic, assign) TTParent *parent;//use assign.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment