Re: Never ending lack of memory
Re: Never ending lack of memory
- Subject: Re: Never ending lack of memory
- From: email@hidden
- Date: Sat, 8 Mar 2003 20:56:40 +0100
On samedi, mars 8, 2003, at 08:50 PM, Lorenzo Puleo wrote:
Hi,
thank you for helping me.
I know that if you create a NSString with some "init" method +
"alloc", then
you have to release the NSString.
But if you use other methods you don't need to release the string.
The same is for NSArray, and other classes.
Do I know wrong?
You're correct but the point you're forgetting is that the autorelease
thing is just a delayed release in the event loop. Autorelease object
are released when the autorelease pool is itself released (i.e. in the
Event loop for the main thread in a standard NSApplication AFAIK). So
as long as you don't come back to the event loop, the memory is not
released.
Also, just to understand if the problem comes from the method recursion
(which requires memory any time), and not from the variables memory,
I tried to do only
- (BOOL)ScanSingleFolder:(NSString*)sourceDir
{
[self ScanSingleFolder:subItem];
return YES;
}
And after 508 recursions my Application crashed. Why?
May be this crash log line (the last one)
could help you to understand better the problem.
#508 0x0001a048 in -[MyMainClass ScanSingleFolder2:]
(MyMainClass.m6760)
This crashlog is saying that your're not just [self
ScanSingleFolder:subItem]; inside ScanSingleFolder.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.