Re: Memory Allocation
Re: Memory Allocation
- Subject: Re: Memory Allocation
- From: "Gary L. Wade" <email@hidden>
- Date: Wed, 16 Jul 2008 15:56:22 -0400
You mentioned you launched your application with ObjectAlloc; launch it instead with MallocDebug and do your testings with the Leaks option to check for memory leaks. It will show you an execution path so you can determine where the allocation originated that is leaking.
>On Wed, Jul 16, 2008 at 20:38, Kyle Sluder
><email@hidden> wrote:
>> On Wed, Jul 16, 2008 at 2:02 PM, Alexandre Badez
>> <email@hidden> wrote:
>>> -(id)init
>>> {
>>> if (![super init])
>>> return nil;
>>
>> You must always assign self to the result of [super init]. If anyone
>> (*cough* Wil Shipley *cough*) tells you otherwise, they may
>> inadvertently set you up for some seriously subtle errors.
>>
>> So the code would be:
>>
>> - (id)init
>> {
>> if(self = [super init]) // single = is intentional
>> NSLog(@"-[%@ init]", [self className]);
>>
>> return self;
>> }
>
>Thanks for this tips !
>
>
>> Anyway, your problem is here:
>>
>>> NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
>>
>> Why are you doing this? AppKit creates an autorelease pool for you.
>
>Well actually, I did not put this autorelease pool in my first
>attempt. But when I've that the prog was growing in ObjectAlloc, I
>though that I should create a pool to drain autorelease NSString
>returned by stringWithFormat:.
>The fact is that even with this pool, the memory is still growing...
>
>Any idea about that ? Is it my fault ?
>
>--
>Alex
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden