That's very interesting. Can you determine what objects are hanging
> The JS code should have been:
> (function() {
> var pageTracker = _gat._getTracker("UA-1107851-4");
> pageTracker._initData();
> pageTracker._trackPageview();
> pageTracker = null;
> })();
> which doesn't make any difference in solving the memory leaks...
> On Jan 18, 5:37 pm, calicardiff wrote:
> > Forget the last comment - I was getting ahead of myself and didn't
> > check the code correctly (it's been a long week) :(
> > On Jan 18, 5:12 pm, calicardiff wrote:
> > > Ah-ha solved it !
> > > If you just put the JS code within an anonymous function then all
> > > allocated memory objects get cleared correctly when the page is
> > > unloaded as so:
> > > <script type="text/javascript">
> > > function() {
> > > var pageTracker = _gat._getTracker("UA-1107851-4");
> > > pageTracker._initData();
> > > pageTracker._trackPageview();}
> > > </script>
> > > If any Google-type dev is reading this then I'd recommend updating the
> > > basic cut-n-paste text to include this little addition.
> > > On Jan 18, 4:52 pm, calicardiff wrote:
> > > > I tried your suggestion of replacing the document.write() with a
> > > > simple <script> include, however it still leaks memory.
> > > > The actual call that causes these memory leaks is the
> > > > "pageTracker._trackPageview();" one and it causes leaks in all
> > > > browsers (the Mac version of Safari with the Debug menu reports that
> > > > the web page has several objects still hanging around when it tries to
> > > > unload the page).
> > > > On Jan 18, 1:55 pm, ShoreTel wrote:
> > > > > Can you provide any more details? Which functions/arrays/variables are
> > > > > causing the memory leak?
> > > > > Out of curiosity have you tried stripping out the HTTP/HTTPS
> > > > > autodetection and just using the proper version for your site (I know
> > > > > I'm a broken record about that, but maybe document.write()'ing a
> > > > > <script> tag causes a memory leak too). See here:http://groups.google.com/group/analytics-help-troubleshoot/msg/e712ab...
> > > > > If none of that helps, what if you keep the
> > > > > <script type="text/javascript" src="http://www.google-analytics.com/
> > > > > ga.js"></script>
> > > > > but take out the
> > > > > <script type="text/javascript">
> > > > > var pageTracker = _gat._getTracker("UA-xxxxxx-x");
> > > > > pageTracker._initData();
> > > > > pageTracker._trackPageview();
> > > > > </script>
> > > > > I wonder if it's inherent in the code, or if it only occurs during
> > > > > execution.
> > > > > On Jan 18, 9:47 am, calicardiff wrote:
> > > > > > We've just noticed that the latest ga.js code causes significant
> > > > > > memory leakage with both IE6 & IE7. I've used sIEve-0.0.8 to verify
> > > > > > this with an absolute basic HTML page that contains nothing but the
> > > > > > required JS code.
> > > > > > Has anyone seen anything similar or know what to do to prevent this as
> > > > > > obviously we can't use this on a large-scale production web site right
> > > > > > now?
> > > > > > <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
> > > > > > <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
> > > > > > <head>
> > > > > > <title>Google Analytics memory leak test</title>
> > > > > > </head>
> > > > > > <body>
> > > > > > <script type="text/javascript">
> > > > > > var gaJsHost = (("https:" == document.location.protocol) ? "https://
> > > > > > ssl." : "http://www.");
> > > > > > document.write(unescape("%3Cscript src='" + gaJsHost + "google-
> > > > > > analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
> > > > > > </script>
> > > > > > <script type="text/javascript">
> > > > > > var pageTracker = _gat._getTracker("UA-xxxxxx-x");
> > > > > > pageTracker._initData();
> > > > > > pageTracker._trackPageview();
> > > > > > </script>
> > > > > > </body>
> > > > > > </html>