Serious Memory Leak problems

1,596 views
Skip to first unread message

Ela

unread,
Jul 28, 2010, 8:03:47 AM7/28/10
to Google Maps JavaScript API v3
Hi,
I'm in a team which is actually programming a business application and
we want to use google maps as the map component.
The problem I have for a while now is that all examples I find within
the documentation cause memory leaks in IE.
I'm using IE8 on Windows 7.
Our cusomers also use IE 7 and 8, so there is no way to tell them to
use another browser, if the browser might be the reason (I don't think
so).

For examle, take the Hello World example from here
http://code.google.com/intl/de/apis/maps/documentation/javascript/tutorial.html,
this is a very simple page. But if you load the page in IE and press
F5 multiple times, you can see that the memory usage of IE is
constantly growing and growing and IE will never free this memory.

This is an absolutly obvious memory leak isn't it?

I've googled through the group and other pages but couldn't find a
solution which unloads EVERYTHING from the page and frees the memory
of google maps' api. Is there any way to do this?

I'm wondering why so many example code snipplets don't care about
cleaning event listeners or removing objects from arrays and
references etc. Do the google api simply don't care about that? If
this is the case it would be great to know, too!!


Back to my main problem. The application I'm currently working on is
an ajax application. The user will not reload the page until he logs
out. That means that any memory leaks in javascript code causes the
application to unserviceable after some time.
The application uses tabs (jquery). On each tab we have a map with a
lot of markers and other overlays.
The problem is, that if I create a map object for a tab, work with it,
and than close the tab, there is no way to unload the map object.
There are no cross references or events which might cause the memory
leaks, it is simply the map object (I'm absolutly sure about this
because I've build several test page to proof this...)

A simple test would be to create 10 maps instead of one in the above
sample and than unload them (set them to null or what, remove the div
or click F5).
The result will always be the same -> Memory Leak in IE7/8 and FF.

Would be very nice if some can help me!

Thanks

ben_a

unread,
Aug 6, 2010, 4:55:22 PM8/6/10
to Google Maps JavaScript API v3
I can confirm this too. I'm seeing a memory leak even though I'm
refreshing the iFrame in which my map is stored, so I would expect all
objects to be destroyed during the reload.

I'm fairly certain this does not happen in Firefox. I built a map that
refreshes every 60 seconds and tested it with Firefox for hours
without failure.

Is there a problem with IE and garbage collection?

On Jul 28, 7:03 am, Ela <klette...@web.de> wrote:
> Hi,
> I'm in a team which is actually programming a business application and
> we want to use google maps as the map component.
> The problem I have for a while now is that all examples I find within
> the documentation causememoryleaks in IE.
> I'm using IE8 on Windows 7.
> Our cusomers also use IE 7 and 8, so there is no way to tell them to
> use another browser, if the browser might be the reason (I don't think
> so).
>
> For examle, take the Hello World example from herehttp://code.google.com/intl/de/apis/maps/documentation/javascript/tut...,
> this is a very simple page. But if you load the page in IE and press
> F5 multiple times, you can see that thememoryusage of IE is
> constantly growing and growing and IE will never free thismemory.
>
> This is an absolutly obviousmemoryleak isn't it?
>
> I've googled through the group and other pages but couldn't find a
> solution which unloads EVERYTHING from the page and frees thememory
> of google maps' api. Is there any way to do this?
>
> I'm wondering why so many example code snipplets don't care about
> cleaning event listeners or removing objects from arrays and
> references etc. Do the google api simply don't care about that? If
> this is the case it would be great to know, too!!
>
> Back to my main problem. The application I'm currently working on is
> an ajax application. The user will not reload the page until he logs
> out. That means that anymemoryleaks in javascript code causes the
> application to unserviceable after some time.
> The application uses tabs (jquery). On each tab we have a map with a
> lot of markers and other overlays.
> The problem is, that if I create a map object for a tab, work with it,
> and than close the tab, there is no way to unload the map object.
> There are no cross references or events which might cause thememory
> leaks, it is simply the map object (I'm absolutly sure about this
> because I've build several test page to proof this...)
>
> A simple test would be to create 10 maps instead of one in the above
> sample and than unload them (set them to null or what, remove the div
> or click F5).
> The result will always be the same ->MemoryLeak in IE7/8 and FF.

Kesuke

unread,
Aug 6, 2010, 9:36:01 PM8/6/10
to Google Maps JavaScript API v3
I can also confirm this. In V2 we used to put onUnload="GUnload()" in
the body tag, and if you look at the V2 'hello world' example (which
includes the GUnload) you should notice that it does not have this
memory issue.

But I'm not aware of a V3 equivalent or workaround and have also seen
effectively the same issue raised here: http://code.google.com/p/gmaps-api-issues/issues/detail?id=772
which still remains open. The OP who initally brought that up
mentioned back in Oct 08 that the increasing use of AJAX to avoid full
reloads would exaccerbate this problem in the near future - apparently
he was correct.

On Jul 28, 1:03 pm, Ela <klette...@web.de> wrote:
> Hi,
> I'm in a team which is actually programming a business application and
> we want to use google maps as the map component.
> The problem I have for a while now is that all examples I find within
> the documentation cause memory leaks in IE.
> I'm using IE8 on Windows 7.
> Our cusomers also use IE 7 and 8, so there is no way to tell them to
> use another browser, if the browser might be the reason (I don't think
> so).
>
> For examle, take the Hello World example from herehttp://code.google.com/intl/de/apis/maps/documentation/javascript/tut...,
Reply all
Reply to author
Forward
0 new messages