6

Garbage collection ?

asked 2013-11-05 13:11:20 +0800

sitansu gravatar image sitansu
2254 13
http://java91.blogspot.in...

updated 2013-11-05 13:12:34 +0800

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 --js-flags="--expose-gc" and running gc(), but it throws an exception:

ReferenceError: gc is not defined

This doesn't happen on Firefox -- memory usage is more or less a constant.

Force refreshing the page is not an option.

We would be grateful for any and all suggestions.

EDIT: we've tried running window.gc() and gc() both on Chrome versions 23.0.1271.97 m and 25.0.1364.2 dev-m

delete flag offensive retag edit

1 Answer

Sort by ยป oldest newest most voted
3

answered 2014-01-19 09:13:10 +0800

sitansu gravatar image sitansu
2254 13
http://java91.blogspot.in...

updated 2014-01-19 09:14:04 +0800

Fetch code of Chrome Dev Tools, modify it so that ProfilerAgent.collectGarbage(); is called every now and run Chrome version of DevTools using --debug-devtools-frontend flag. I propose profiling application and checking out why v8 decides not to clean the garbage (or can't clean the garbage). 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.

link publish delete flag offensive edit
Your answer
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow
1 follower

RSS

Stats

Asked: 2013-11-05 13:11:20 +0800

Seen: 26 times

Last updated: Jan 19 '14

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More