Subscribe to
Posts
Comments
NSLog(); Header Image

leaks Safari

Go ahead, run leaks Safari. I dare you.

[10:01am iacas@Bunny:~] % leaks Safari
Process 318: 909079 nodes malloced for 90364 KB
Process 318: 9329 leaks for 273936 total leaked bytes.

That looks worse than it is (it's in bytes), but nine thousand of them?

3 Responses to "leaks Safari"

  1. I'm betting it's NSURL resourceDataUsingCache: NO, which has a low-level memory leak.

    Test code, compile and let run, watch process mem usage gradually increase:

    Compile and run the following example code:

    int main (int argc, const char * argv[]) {
    	while( 1)
    	{
    		NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
    		NSString *prefsBBURL = @"http://planetx.geneseo.edu/bb/";
    		NSData *data;
    		NSURL *url;
    		// sorry about the pounding
    		url = [NSURL URLWithString: prefsBBURL];
    		data = [url resourceDataUsingCache: NO];
    		[pool release];
    	}
        return 0;
    }
  2. [quote comment="44827"]I'm betting it's NSURL resourceDataUsingCache: NO, which has a low-level memory leak.[/quote]

    From what I've read and tested it could also be sheets that leak. I just posted so people know to check and perhaps re-launch Safari from time to time given the long uptimes many Macs see.

  3. Jake: That doesn't seem to leak on my system (running 10.5.1). It looks to me like Apple fixed it.

    In my experience Safari 3 leaks less than Safari 2. And it leaks less on Leopard than it did on Tiger. With Safari 2 on Tiger I had to restart Safari at least once a day, or it would be using well over a gigabyte of real memory.

    I think the Flash plugin leaks memory significantly, though.