Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6586873
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T16:50:47+00:00 2026-05-25T16:50:47+00:00

I have been experiencing Javascript Out of Memory errors with a Web App that

  • 0

I have been experiencing Javascript Out of Memory errors with a Web App that loads a Google Map and continuously pans from one point to the other. It takes about a half day before it runs out of memory, but I would really like it to last far longer. I
have identified that the memory leak occurs when the map.panTo method is used, although
I very much suspect that it could be the way I’m using it (Javascript is not my strong
suit). Can you please look at this code and help me fix this memory leak? I have sped up the interval that it pans in this demo code for sake of time during debugging (the leak is obvious even by checking the process in Windows Task Manager). This runs off of ASP .Net 3.5 Web Forms, but there are no PostBacks and the code is completely HTML, CSS, and Javascript. It leaks the worst in IE (which is what I need to use to display this).

Edit:

  1. I have tried using different versions of the Google Maps API (2, 3.0, and 3.6).
  2. I know that I don’t need to put the map in the example code into a Hashtable or Array, but that doesn’t affect the memory leak anyways.
  3. I’m trying to avoid a hack, such as refreshing the page every so often or using the static Google Maps API.
  4. Bounty will go to whoever figures out how to fix the memory leak or whoever clearly identifies and proves why it can’t be fixed (if that is the case).

Code:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
    <title>Map Shifter</title>
    <style type="text/css">
        #divMap { height: 400px; width:400px; position:absolute; top:10%; left:10%; border: 2px solid #ff1100; }    
    </style>
    <script type="text/javascript" src="http://maps.google.com/maps/api/js?v=2&sensor=false"></script>
    <script type="text/javascript" language="javascript">
        //Have tried both HashTable and Array (Both Leak)...
        var m_arrMaps = new HashTable(); //new Array();
        var m_Timer;
        function HashTable() {
            return this;
        }
        function LoadMapAndStartShifting() {
            var objMapCenterPoint = new google.maps.LatLng(20.5, -156);
            var objMapOptions = { zoom: 9, center: objMapCenterPoint, mapTypeId: google.maps.MapTypeId.ROADMAP,
                scaleControl: false, streetViewControl:false, zoomControl: false, mapTypeControl: false, panControl: false
            }
            var map = new google.maps.Map(document.getElementById("divMap"), objMapOptions);
            m_arrMaps["ShiftingMap"] = map;
            setTimeout("ShiftMap(20.5, -156);", 700);
        }
        function ShiftMap(decLat, decLng) {
            var objLatLong = new google.maps.LatLng(decLat, decLng);
            //Have tried setCenter instead of preferred panTo and it still leaks!
            m_arrMaps["ShiftingMap"].panTo(objLatLong);
            if (decLat == 20.5) {
                //Leaks...
                ResetTimer(39, -87);
            }
            else {
                //Still leaks...
                setTimeout("ShiftMap(20.5, -156);", 700);
            }
        }
        function ResetTimer(decLat, decLng) {
            m_Timer = setTimeout("ShiftMap(" + decLat + ", " + decLng + ");", 700);    
        }    
    </script>
</head>
<body onload="LoadMapAndStartShifting();">
    <form id="form1" runat="server">
    <div id="divMap"></div>
   </form>
</body>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T16:50:47+00:00Added an answer on May 25, 2026 at 4:50 pm

    You can try refreshing the page once you have looped through your data using JavaScript. That might free the memory being used by the script running on the page:

    How to redirect to another webpage in JavaScript/jQuery?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been experiencing a problem with tortoise . when i checked out the
I have a new web app that is packaged as a WAR as part
I have been experiencing an intermittent issue in my Rails app, and I'm having
I have been experimenting with woopra.com A web analytics tool. Which requires a piece
I have been experimenting with WPF and rendering strict XAML markup in a web
Have been looking at the MVC storefront and see that IQueryable is returned from
I have been working on a web services related project for about the last
I'm experiencing an error that I haven't been able to find any mention of
I have been experimenting with using javascript to dynamically write stylesheets. In Firefox, one
I have been experiencing a strange issue in Flex Builder 3 where certain dialogs

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.