When multiple tabs are opened and then closed before they are loaded, I see several memory leaks. Most recently, the following (although exactly what is leaked seems to vary somewhat)
1) Close all safari windows except one.
2) If you do not have a bookmark folder with 10 or more bookmarks in it, you'll need to make one, preferably with a few pages that take a while to load fully near the end of the list and a page that loads fast first (this is not required, it just helps).
3) Hover your fingers over Cmd-W, because you are going to need to be fast on the uptake here.
4) Open the bookmark folder in tabs (Cmd-click or select from the bottom of the folder list)
5) As soon as ANY content is displayed on the first page (use a fast page to ensure that the other pages are still loading!), press and hold Cmd-W until all tabs and finally the window are closed. Note that if you do not HOLD Cmd-W down the entire time, it happens much less often (if at all).
The "Leaks" window comes up, and often displays again several times after you press OK (it seems like each tab may leak that or something similar)
Another run of this to make sure it still happens in r34822 (it does), and I got the following (the window displaying this information re-opened 5 times, FWIW)
It should work with any collection of webpages so long as at least a couple are still loading content (or is still trying to start loading content) when it is closed and so long as the first tab loads at least a little data (realistically, ANY tab needs to load some data, but it is easiest to tell on the first tab, obviously). I can post the bookmarks in a folder I have that always reproduces this if need be, but if it isn't needed I won't. It has worked with every random collection of webpages I have tried it with.
This is not a regression, also happens in shipping safari 3.1.1 on 10.5.3. shipping safari's leak message:
1 BrowserDocument object, 1 WebView object, 1 WebFrame object, 1 WebDataSource object, 1 WebFrameView object, 1 WebHTMLRepresentation object, 1 WebBridge object.
Again, what exactly is leaked seems to vary (probably depending on what pages are loading, loaded, or trying to load at the time, etc), but it is always a long list like that.
This does NOT happen if you "close all tabs" (Shift-Cmd-W), even in the same circumstances. I just never REMEMBER that keyboard shortcut exists, so if I accidentally open a tab group i usually just hold Cmd-W.
If you follow your steps, then open a new window, wait a few moments, then close it do you see another leak dialog?
(In reply to comment #1)
> If you follow your steps, then open a new window, wait a few moments, then
> close it do you see another leak dialog?
Not right now, I don't. I know I have seen that before fairly recently (within the week), but I'll be honest I usually just quit Safari (or WebKit if I am using a nightly) and launch it again when I see when of those messages, so I am not sure when exactly. I just tried several times in both r34822, r34824, and shipping 3.1.1 and could not get it to come up on the next window (i tried both letting the new window's page load fully or cutting it off before it loaded). If I see that happen in the near future, I'll be sure to note it here.
(In reply to comment #2)
> (In reply to comment #1)
> > If you follow your steps, then open a new window, wait a few moments, then
> > close it do you see another leak dialog?
> Not right now, I don't.
Open mouth, insert foot. In an attempt to test it "one more time, just in case", I did get it to come up for the next (and all subsequent) window(s) opened in r34824
this time, the leak is
1 WebFrame object.
If you close tabs rapidly then the leak detection timer can fire before all the relevant cleanup has completed, leading to many false positives. I believe that is what you are seeing based on the steps that you describe. To verify that it is a legitimate leak you need to pause for five or ten seconds, open a blank window, close it, and wait to see if you see another dialog. If you can reproduce a leak after following these extra steps, please let me know.
(In reply to comment #4)
> If you close tabs rapidly then the leak detection timer can fire before all the
> relevant cleanup has completed, leading to many false positives. I believe
> that is what you are seeing based on the steps that you describe. To verify
> that it is a legitimate leak you need to pause for five or ten seconds, open a
> blank window, close it, and wait to see if you see another dialog. If you can
> reproduce a leak after following these extra steps, please let me know.
More testing, and I can't get it to happen. i guess I am hitting this, then.
Would it be possible to make the timer on the leak check wait a little longer to lessen the amount of this and similar false positives (i just tested rapidly Cmd-N, Cmd-W-ing over and over and got a similar message)? Or would it have to be lengthened to such a degree that the dialog would no longer open more or less at the same time as the window closes?
The alert only appears if you have explicitly turned on "Always Check for World Leaks" in Safari's "Debug" menu. If you're not interested in them, feel free to turn it back off.