[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Finding those nasty memory leaks

From: Andrew Ruder
Subject: Finding those nasty memory leaks
Date: Tue, 22 Jul 2003 02:07:34 -0500
User-agent: Mutt/1.5.4i

Here is a little tool that I wrote two days ago in Ruby.
It is a very crude parser of Objective-C and will tell
you two things:

1. Any class that has a dealloc method and doesn't call [super dealloc]
2. Any class which defines a instance variable and doesn't release
   it in the dealloc method.

Example use:

ruby MemLeak.rb core/gui/Headers/AppKit/*.h core/gui/Source/*.m

Then its just a matter of checking out all the warnings to see
if they do indeed need to be released.  Hopefully some other people
found this as useful as I did in finding some memory leaks.

By the way, there are a lot of different things that this script
will have trouble parsing or will get messed up on.  I know this,
but for the common cases it will suffice.  If you have problems
the code isn't too complex (and for any ruby experts, I know the
code is probably horrible, its my first ruby program, so be

Thanks, and have fun!
Andrew Ruder

Attachment: MemLeak.rb.gz
Description: Binary data

reply via email to

[Prev in Thread] Current Thread [Next in Thread]