discuss-gnustep
[Top][All Lists]
Advanced

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

Re: Memory Debug Strategy


From: Andrew Sveikauskas
Subject: Re: Memory Debug Strategy
Date: Thu, 25 May 2006 11:40:22 -0400

On 2006-05-25 10:18:31 -0400 Richard Stahl <rstahl@cisco.com> wrote:
What is the general strategy for debugging memory leaks and heap corruption in applications using GNUStep? Are there any tools available like ObjectAlloc and MallocDebug for MacOS X?

Here's what I find useful based on my experiences:

1. env NSZombieEnabled=1 openapp Whatever

This will make NSObject -dealloc turn all of your deallocated objects into instances of the "NSZombie" class, which will print an error whenever a method is called. That is, whenever a deallocated object is reused you'll be told about it.

2. If it's an application, a good quick way to find leaks is to double-click the icon in the standard about panel. It will bring up a panel which gives some statistics about allocated objects.

3. If you're using Linux on x86, valgrind can do wonders. Although I've found it can be less helpful for GNUstep apps because a lot of the stack traces you'll get will be from NSRunLoop and it can sometimes be hard to find where the actual problem is.

Andrew





reply via email to

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