We are developing a single-page web app with ZK which constantly communicates with server and updates parts of its screens. Updating can be as frequent as 1s. During these updates, references to large ammounts of JS objects are lost and those objects have to be cleaned by garbage collector eventually.
As far as we've figured out, Chrome only runs its garbage collector on inactive tabs. This is a problem for us, because the app's tab is usually active and almost never refreshed, thus JS objects never get collected. If left active for enough time, the tab eventually crashes (Aww Snap message).
We need to initiate garbage collection manually. So far we've tried running Chrome with
ReferenceError: gc is not defined
You can fetch code of Chrome Dev Tools, modify it so that
ProfilerAgent.collectGarbage(); is called every now and then (it's a code that is called when you click 'Collect Garbage' button on the Timeline panel) and run Chrome with your version of DevTools using
[EDIT] I removed info about chrome extension, as it turns out that
gc() can be called from webpage code when
--js-flags="--expose-gc" is used. At least on my 23.0.1271.64.