8 ms·
(Disclaimer: V8 dev) This post is unfortunately nonsense, because it's making a fundamental measurement error: not including renderer processes for Safari, and
by Leszek 6y ago
(Disclaimer: V8 dev)
This post is unfortunately nonsense, because it's making a fundamental measurement error: not including renderer processes for Safari, and only measuring the browser process (which should be expected to be roughly O(1) memory in the number of tabs).
To the author's credit, they _are trying_ to include child processes - I'm not sure why, but `psrecord` seems to not (in local testing) include child processes for Safari even when the "--include-children" flag is passed. I guess it does for Chrome, for whatever reason.
I'm somewhat disappointed that the author, or half the comments on the post, didn't question these _wildly_ different results though...
- mayli 6y agoThat's pretty much what I suspect from those numbers. Safari seems having constant memory usage no matter how many tabs you open. Unless its unloading inactive tabs from ram, there is no way Safari can save ram by using almost 0MB for new tabs.
- bzzzt 6y agoCan confirm this as a Safari user: old tabs are reloaded sometimes. I guess it's related to memory pressure on the system, seems to be a lot more common on iOS (which of course runs on more RAM-constrained devices).
- dmitriid 6y ago> I'm somewhat disappointed that the author, or half the comments on the post, didn't question these _wildly_ different results though... Given that Chrome is busy trying to subsume the web and the OS (it has bluetooth now, and usb, and serial ports, and over a thousand chrome-specific web apis [1]), no one is even remotely surprised to see such results, because by now people just assume Chrome to be a beast. And Chrome has in the past been the most RAM-eating of all browsers out there. The graphs should be questioned, of course, but Chrome has already earned its reputation, and it's very hard to un-earn it. [1] https://web-confluence.appspot.com/#!/confluence https://web-confluence.appspot.com/#!/confluence see "Browser-Specific" tab
- striking 6y agoThis is a bizarre rationalization of a misleading post. So what if Chrome has features, some of which you don't care for? That doesn't make the post right.
- aae42 6y agohe's not rationalizing the original post, he's rationalizing the thread parent's > half the comments on the post, didn't question these _wildly_ different results though...
- bberenberg 6y agoThis is really interesting feedback, but you didn't respond to the Flotato numbers (since this is an ad for their software). Is the dev tricking themselves into thinking they're doing well because they're measuring their own app usage incorrectly?
- sitharus 6y agoFrom what I can tell - yes. Their app uses the standard Safari render processes, so they're only seeing the cost of the main process.
- saagarjha 6y agoYep. Safari is good, but it's not magic. I suspect psrecord doesn't catch Safari processes because Safari sends them off to launchd because they get launched via XPC, while Chrome's subprocesses are "true" children.
- freediver 6y agoThat is correct. I actually spend half a day trying to find a way to get aggregate memory usage of Safari. You can get most of Safari processes using plain ps as they share the same command: ps x -o rss,command | grep Safari There will be a few system threads (for example used for video rendering) that you will have to tie back to one of the processes using launchctl. Fun fact: activity monitor actually does it through undocumented private APIs as documented here: https://apple.stackexchange.com/questions/327290/how-process-hierarchy-works-in-macos https://apple.stackexchange.com/questions/327290/how-process... Hope it saves someone half a day!
- saagarjha 6y agoThe kernel actually keeps track of this information in an internal "responsibility" field for each process. The private API to retrieve this information (which Activity Monitor uses) is responsibility_get_pid_responsible_for_pid, exported from /usr/lib/system/libquarantine.dylib.
- souprock 6y agoOK, but the situation still looks shameful. What exactly prohibits a web site from consuming all my RAM? I have never once seen a browser make a misbehaving site wait (frozen with no CPU) for me to confirm that sucking up more RAM is acceptable to me. What happens instead is that I hit a wall of slowness, forcing me to press the power button and lose all my other work. It's not very gradual, I think due to the nature of the problem, so the browser needs to avoid getting into the situation. It's like UI latency follows a hyperbolic curve, running right up to infinity all of a sudden as the RAM runs out.
- neolog 6y ago> browser make a misbehaving site wait would be a nice operating system feature
- boring_twenties 6y agoWhat ever happened to computers being at least somewhat usable when all RAM is in use? I seem to remember that being a pretty common condition back in the 90's. Things would get slow, sure, but not completely and utterly hosed. When this happened to me recently (unattended Firefox process used up all RAM) the machine was simply never able to recover, even after killing the offending process (thereby making 30GB or so of RAM available) and waiting a half an hour.
- young_unixer 6y agoFor some reason, Linux is specially bad at working under load, both memory (too many applications & browser tabs open) and I/O (copying large files into USB drive).
- fire7000 6y agoHow much performance are you expecting moving data over usb that should be moved over sata/sas
- lasagnaphil 6y agoIs it because Linux is optimized more for server purposes rather than desktop ones (For example, when it comes to process scheduling)? I’m curious.
- dunham 6y agoistat menus seems to better report aggregate memory usage. I’m getting 750 mb for Safari on a clean launch with just those two tabs. (It drifts up to 850 mb and back down if I interact with them.)
- olliej 6y agoI was looking at those graphs and thinking exactly that, but that’s a byproduct of google marketing making it sound like chrome is the only browser that does that :D