RESOLVED FIXED39825
Memory retention using timers (when viewing inspector timeline)
https://bugs.webkit.org/show_bug.cgi?id=39825
Summary Memory retention using timers (when viewing inspector timeline)
Christopher Hunt
Reported 2010-05-27 03:48:44 PDT
Created attachment 57216 [details] Screen shot of memory consumption I'm wondering if there's a memory retention issue given the use of timers. Here's some html: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <html> <head> <title>Timer Memory Retention</title> </head> <body> <p>Please observe memory usage with the timeline profiler.</p> <script type="text/javascript"> setInterval(null, 100); </script> </body> </html> What we have is a script that simply sets up a timer to execute every 100ms. It makes no difference to the test whether a function is called on the timer firing. If you load this and then use the timeline profile then you should observe memory continue to be consumed. Within a couple of minutes memory usage doubles. I have had this running for several minutes with no apparent reduction in the rate of memory consumed. I have attached a screenshot of the memory consumption timeline.
Attachments
Screen shot of memory consumption (150.16 KB, image/png)
2010-05-27 03:48 PDT, Christopher Hunt
no flags
Screen shot of memory profile using Instruments (137.24 KB, image/png)
2010-06-01 21:36 PDT, Christopher Hunt
no flags
Sample HTML file to reproduce the issue (370 bytes, text/html)
2010-07-24 15:41 PDT, Christopher Hunt
no flags
Simon Fraser (smfr)
Comment 1 2010-05-27 18:26:13 PDT
I hope the timeline profiler excludes memory use by the inspector itself.
Geoffrey Garen
Comment 2 2010-05-27 23:46:07 PDT
(In reply to comment #1) > I hope the timeline profiler excludes memory use by the inspector itself. It doesn't. That could be the issue.
Christopher Hunt
Comment 3 2010-05-28 01:03:18 PDT
Hi Geoff. Do you have a feel for whether this issue is easily resolved?
Geoffrey Garen
Comment 4 2010-05-28 10:07:41 PDT
(In reply to comment #3) > Hi Geoff. Do you have a feel for whether this issue is easily resolved? If the Web Inspector guess is true, it's not easily resolved. We would need to move the Web Inspector to use a separate heap/JSGlobalData. Doable, but nontrivial.
Christopher Hunt
Comment 5 2010-06-01 19:50:41 PDT
I've now downloaded WebKit and built it. I'd be happy to have a go at fixing this issue if someone can point me in the right direction. I have a memory retention issue in my application in production and I simply must nail down what is causing it so I'm keen to help!
Simon Fraser (smfr)
Comment 6 2010-06-01 20:33:43 PDT
> I have a memory retention issue in my application in production Is this on Mac OS X? Have you tried the simple stuff, like running 'leaks'?
Christopher Hunt
Comment 7 2010-06-01 20:40:35 PDT
(In reply to comment #6) > Is this on Mac OS X? Have you tried the simple stuff, like running 'leaks'? I confess to not having tried leaks - I've not been regarding the problem as a memory leak; more of a retention issue within Javascript. I shall of course try this, though I'd still like to help with this particular issue. It seems to me that the memory profiler being introduced is de-valued if there is a fundamental issue in its consideration of gathering metrics.
Christopher Hunt
Comment 8 2010-06-01 21:34:58 PDT
(In reply to comment #7) I just profiled the app using leaks as part of Instruments under OS X. What I found was that WebKit/Safari does *not* appear to be leaking memory adding strength to the view that the memory profiler of WebKit is not considering its own object allocations in its output. I attach the Instruments view over several minutes of running WebKit/Safari (debug build). Any ideas then on where I should start looking in the WebKit code with a view to helping fix the memory profiler part of the Web Inspector?
Christopher Hunt
Comment 9 2010-06-01 21:36:04 PDT
Created attachment 57619 [details] Screen shot of memory profile using Instruments
Christopher Hunt
Comment 10 2010-06-08 04:56:37 PDT
Anyone out there care to point me toward some doco that gives an introduction to the Web Inspector architecture, or better still a hint on where to start looking? I would have thought they'd be some interest in getting this problem resolved...
Christopher Hunt
Comment 11 2010-07-24 15:41:34 PDT
Created attachment 62510 [details] Sample HTML file to reproduce the issue Attached an HTML/JS file that easily illustrates the problem.
Christopher Hunt
Comment 12 2012-07-08 00:33:45 PDT
Still a problem with Lion, and also occurs with the Canary build of Chrome. Any interest at all out there?
Brian Burg
Comment 13 2014-12-04 16:03:42 PST
This should be resolved now that Inspector runs in its own process. Please re-open or file new bug if you feel that's not the case.
Note You need to log in before you can comment on or make changes to this bug.