Skip to content

Instantly share code, notes, and snippets.

@joenoon
Created December 13, 2013 20:41
Show Gist options
  • Save joenoon/7950988 to your computer and use it in GitHub Desktop.
Save joenoon/7950988 to your computer and use it in GitHub Desktop.
drop-in to see allocations and deallocations.
# [ UIViewController, UIView, etc. ]...
[ UIViewController ].each do |klass|
klass.class_eval do
def self.allocWithZone(zone)
super.tap do |x|
p " + alloc! #{x.inspect}"
end
end
alias_method 'old_dealloc', 'dealloc'
def dealloc
p " - dealloc! #{self.inspect}"
old_dealloc
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment