10

I know I'm not the first one to wonder this.

Something like the Chrome Task Manager.

In short, when you have multiple tabs/pages open in the new Safari 7 (shipped with Mavericks), each one is launched as a separate system process. You can view the list of processes in Activity Monitor, but you cannot see the underlying page or URL of each process.

This would be very helpful for troubleshooting a runaway or hanging page that's sucking up RAM or CPU cycles.

Apple removed the Activity window in Safari 6. And now with Safari 7, the separate processes are great, but more granular info about each tab would be really great.

Anyone?

  • Yep, the Activity window going away is a great loss. But the Activity window far from perfect. In Yosemite's Safari, Apple has taken the issue into account. We will see how. – Nicolas Barbulesco Jun 6 '14 at 20:05
6

If you hover you mouse over the name of the Process a Tooltip will show up telling you the URL Base domain

enter image description here

| improve this answer | |
  • But it is not possible to see the full URL is it? So if I have for example two tabs open, both google.com and each tab has another search request then I won't be able to distinguish between those aren't I? But if nothing more is needed, that this is quite ingenious and much more simple ;D – napcae Oct 26 '13 at 8:50
  • That is correct :-) – markhunte Oct 26 '13 at 9:05
  • 1
    Wonderful, guys. Thanks! Just randomly discovered the mouseover trick on my own and was coming back here to post the find when I saw your responses. I never received any follow-up notifications from stackechange. – dmbream Nov 15 '13 at 18:05
10

This is not an ideal solution but a quite good working workaround.

Open Safari then go to Preferences. Activate the Debug option (Show develop menu in menu bar)

Safari Preference Pane EDIT: Instead of activating the develop menu, you have to open a terminal and activate the debug menu with defaults write com.apple.Safari IncludeInternalDebugMenu -bool true

Thanks @Collin C.

You will find the option Show Web Process IDs in Page Titles under Debug > Miscellaneous Flags

Show Web Process IDs

If you open the Activity Monitor now, you can see the Web Process IDs to the corresponding websites.

Web Process ID and Activity Monitor

I hope this is helping you.

| improve this answer | |
  • 1
    Rather than enabled the developer menu in preferences you have to enable the debug menu via the command line with "defaults write com.apple.Safari IncludeInternalDebugMenu -bool true" – Colin C. Oct 26 '13 at 2:10
  • Nice tip. But we still miss the opposite way : Process → Tabs. – Nicolas Barbulesco Jun 6 '14 at 20:02
3

Update: “Which URLs are associated with each Safari PID?”

This is an update on the topic of seeing which Safari URLs are associated with which PIDs in Activity Monitor. I am using Safari 8.0.6 on Yosemite 10.10.3 with Debug menu on, and with the “Show PIDs in the page titles” option on. (See above and below for how to do this.)

Nicolas B stated that “we still miss the opposite way: Process > Tabs”, referring to looking for a list of tab names based on the single line-item PID in Activity Monitor.

I can show you how to see all of the tabs associated with a particular web process (PID), although it may not completely bring satisfaction, since:

  • it is a multi-step process, and
  • trying to find the logic in PID assignments based on tabs is akin to reading tea leaves it seems.

It should also be remembered that listing all page URLs associated with any single web process within Activity Monitor is not practicable in the UI as it exists today. (I wish Apple’s Safari team would add it into the info window for web processes, however!)

At first, I assumed the name shown on the process line-item referred to the last full page opened by that PID (not including cached pages), but alas this does not appear to be the case. I am not sure how the line-item actually gets its name. I will share the results of my experiment to find the answer following my explanation of how to see what tabs are associated with each line-item in Activity Monitor.

Step-by-Step

  1. Turn on the Debug menu in Safari

  2. Enable the option to Show Web Process IDs in Page Titles (as explained above)

  3. Get this excellent Safari extension from Brett Terpstra, TabLinks.
    (Please donate to him if you find the plugin useful!)

  4. Run the extension by pressing button with the small link icon (Usually left of Safari’s search/location bar)

  5. In the extension, add a separator character into the template used to display the results (for future search-and-replace work).

    I inserted a ying-yang character, so my template was: [%w-%n]:☯%u☯%t. This will give you the results—including the [WP PID] information at the end of each tab name—from Safari’s debugging info.

  6. Copy and paste the results into your favorite text editor app. (Nisus Writer Pro is mine!)

    Do a search-and-replace on your separator character (for me, ☯), and replace them with a tab character (here’s one: ).

    Do another search-and-replace on [WP, and replace only the single leading space with a tab character «tab»[WP. This will allow you to split the PIDs into a separate column in a spreadsheet.

    Save this file as a .tab plain text file.

  7. Open the tab file in a spreadsheet app (I used Numbers) and have fun sorting by PID. Now there's only one more step...

  8. In Activity Monitor, select View ▶︎ All Processes, Hierarchically, and copy-paste the list of line-items showing URLs into your spreadsheet, alongside the tab names and numbers you already have there.

    (You can discard all of the column data you don’t need and just keep the URLs and PIDs in two columns; or, add the Memory column to compare RAM usage, too.)

That’s it; not exactly quick, but not terribly complicated. There’s probably a faster way, but this was my first try to get this info.

After doing this, you may find results similar to mine. I had 9 windows open with a total of 36 tabs, all being contained in 20 “url-style” processes.

(NOTE: Here, I am not including the many QTKitServer and Safari Web Content processes. These run alongside most—if not all—of the “url processes”. These QTKitServer processes have a tiny RAM footprint in comparison to the main “url processes”, e.g., 4.5 MB vs 300 MB.)

Observations

  • I had 9 windows with 36 tabs, running in 20 processes

  • RAM use was total of 5.4 GB (average 258 MB per process)

  • Private memory was 2.0 GB total (average 97 MB per process)

  • Any single process line-item may contain one or more tabs (mine usually had one or two tabs per PID)

  • The URL name in the line-item does not seem to follow any pattern I can discern, except that the name usually (but NOT ALWAYS) reflects the base URL of one of the tabs assigned to that PID

  • Sometimes the URL name is inaccurate! Of my 20 processes, 4 used a URL which was NOT open in any of my tabs.

    (Could these be cached pages, perhaps?)

  • A new tab (or window) may be assigned either to an existing PID, or to a new process, seemingly in a “random” fashion. They are neither sequential, nor grouped with any particular window; thus, any window with multiple tabs can have several PIDs running alongside each other.

This is enough for now! I hope someone a lot smarter than I can come along and explain a little more! Aloha.

| improve this answer | |
0

I wrote an applescript, I normally run it from the terminal but it could be easily modified for some other ease of use that suits you. Output shows window/tab, title, memory used, URL With long strings shortened to start...end

To get the memory size you will need tabs showing process ID as detailed by several posts above.I use a function to run the script via osascript, all noted in the comments in the file.

Example:

Window/Tab: Window Title                      MemoryUse    @  URL (may be missing on old tabs, swap window and many will change)
2/1:Javascript - DEV Community 👩👩‍💻 [WP 72069] [WP 84642] [WP 9351]        14M+    @  missing value
2/2:11 must-see TED Talks | TED Talks [WP 72071] [WP 84643] [WP 9352]         13M+    @  missing value
2/3:Folk Show: Episode 69 by Folk Radio | Mixcloud [WP 84644] [WP 9353]       13M+    @  missing value
2/4:heat exchanger extractor fan kitche...e Search [WP 84645] [WP 9354]       13M+    @  missing value
2/5:Fral Flipperdry 300 portable domest...midifier [WP 84646] [WP 9355]       13M+    @  missing value
2/6:DRI-365 for Homeowners [WP 84647] [WP 9356]                               14M+    @  missing value
2/7:Cart - Ventilation Megastore [WP 7302] [WP 9357]                          13M+    @  missing value
2/8:boulder DHV-20B preheat power - Google Search [WP 7357] [WP 9358]         13M+    @  missing value
2/9:osascript updating script file - Google Search [WP 8935] [WP 9359]        13M+    @  missing value
2/10:osx lion - Prevent an AppleScript s...ts - Stack Overflow [WP 9360]      81M+    @  https://stackoverflow.com/questions/9487...dification-date-when-using
^^^^^^^^^^^^^^^ above is window 2     Active tab 10

1/1:RouterOS -> WPMikroTik -> Interface Traffic Graphing [WP 9361]            87M+    @  http://192.168.88.1/graphs/iface/wlan2/
1/2:Decrypting TLS Browser Traffic With...| Red Flag Security [WP 9362]       86M+    @  https://redflagsecurity.net/2019/03/10/decrypting-tls-wireshark/
1/3:"Show Web Process IDs in Page Title" bug - Google Search [WP 10201]       98M+    @  https://www.google.com/search?client=saf...e%22+bug&ie=UTF-8&oe=UTF-8
1/4:Has anyone figured out how to ident...s? - Ask Different [WP 10202]       202M+    @  https://apple.stackexchange.com/question...-of-each-separate-safari-w
^^^^^^^^^^^^^^^ above is window 1     Active tab 4

Window/Tab: Window Title                      MemoryUse    @  URL (may be missing on old tabs, swap window and URL info will change)
EXPLANATION: Front-most window is 1, last listed. Next window back, if any, will be 2, etc.
Left most TAB is 1/1, right most 1/4, probably the most recent.

Note that there are a few bugs in Safari (11.1.2 at least) so that cache of pages and their titles can result in 0 or more than 1 PID in title, the javascript page has 2 old references from cache but the script takes the last, current, PID. If the URL is not loaded by Safari then process is smaller and the URL string will be missing.

Drop me a PM if interested. I could put it up on github...

| improve this answer | |

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .