3 ms·
> Their whole tabs-as-process thing is too, when you think about it. Could you please explain this too? I like being able to identify and kill individual tab
by nailer 18y ago
> Their whole tabs-as-process thing is too, when you think about it.
Could you please explain this too?
I like being able to identify and kill individual tab and plugin processes.
But I don't understand why you can't garbage collect a thread like the presentation seems to say.
- lacker 18y agoYou can't kill a single thread safely because threads of the same process have shared memory. For example, a thread might be in the middle of some operation that's destructive if it's aborted when only half finished. If this seems unlikely, think of adding an element to a hash table used by many threads and having to resize it, copying all the old elements to the new one. If you kill the thread in the middle of the resize (which might take a while if it's allocating a lot of memory) then all the other threads that use that hash table will get screwed up. There's also no good way to tell which memory is being used by which thread. Often the whole point of threads is that they use shared memory; in this case the memory bloat might be _caused_ by a single thread but end up bloating a data structure that is _shared_ by all threads. By giving each tab its own process, Chrome uses more memory to start out with - each process must have its own data structures for some things which in normal browsers are in shared memory - but hopefully in the long run it will avoid memory leaks.
- jmtulloss 18y agoIt's because there isn't a compacting garbage collector running. The core is C/C++, so it relies on the OS allocator to keep memory from becoming fragmented. The OS allocators are good, but they aren't that good. In a browser you're constantly allocating and freeing large amounts of memory, so you're going to end up with some holes. Its usage pattern is way different than most applications because it's used like Google finally designed it: as a window into a bunch of different processes.
- nailer 18y agoThanks.