3 ms·
You 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 tha
by lacker 18y ago
You 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.