The bug here is to use the garbage collector to collect anything other than memory. You can't collect CPU use with a memory manager.
2010/2/24 Bjorn Tipling <[email protected]>: > Hi, > > This seems like an incorrect way to determine garbage collection: > > > const int lowUsageMB = 256; // If memory usage is below this > threshold, do not bother forcing GC. > const int highUsageMB = 1024; // If memory usage is above this > threshold, force GC more aggresively. > const int highUsageDeltaMB = 128; // Delta of memory usage growth > (vs. last workingSetEstimateMB) to force GC when memory usage is high. > > This is in /thirdy_party/WebKit/WebCore/bindings/v8/V8GCController.cpp > > The problem with this is that according to my tests, there is never > any garbage collection until you hit lowUsageMB if the tab stays > focused or if you are running this code in a Chrome extension in > background.html. It's not just about memory though, because some > things that stay in memory such as an instance of AudioHostRenderer > eat a lot of CPU, even when paused (a separate bug). > > The tests and bug are below: > > http://code.google.com/p/chromium/issues/detail?id=36237 > > Seems to me that v8 should be a little smarter about when to start > collecting garbage, because if I can quickly eat a lot of CPU with CPU > intensive objects that persist when they should no longer or hit the > upper cap on the low memory limit by creating objects that have a big > memory footprint. Idle tab detection does not save a chrome extension > from this issue. > > Thank you. > > -- > v8-users mailing list > [email protected] > http://groups.google.com/group/v8-users > -- v8-users mailing list [email protected] http://groups.google.com/group/v8-users
