ThinkGeo.com    |     Documentation    |     Premium Support

Out of memory problem

i use AJAX Timer to add a point on the map. Something like every 10 seconds, it grabs a new location and add it to the map:


markerOverlay.Features.Add("Now" + TickCount.ToString(), new Feature(myPoint));


After around 40 points or so, the map will become empty, changed to pink color, and windows pop-up a message that says "Out of memory at line: xxxx". My working PC has 4Gig memory, this should not happen. Sometimes i have to display hundreds of points on the screen. Is there any way to solve this?


 


Ric



Ric,


Just wonder are the map and the Ajax timer put into the same UpdatePanel? As each time the timer ticks, the UpdatePanel refreshes, that makes the map recreated and the memory consumed. 
 
Please reference the sample “DefaultByJavascript.aspx” in the post gis.thinkgeo.com/Support/DiscussionForums/tabid/143/aff/12/aft/4905/afv/topic/Default.aspx .
 
In that sample, you can see the map control and the timer are not in the same UpdatePanel, so the refreshes of timer doesn’t affect the map.
 

     <cc1:Map ID="Map1" runat="server" Height="480px" Width="640px">
        </cc1:Map>
        <asp:UpdatePanel ID="UpdatePanel1" runat="server">
            <ContentTemplate>
                [script removed]
                </asp:Timer>
            
        </asp:UpdatePanel>

    
Any queries just let us know.
 
Ben

Ben, 
  
 In the DefaultByJavaScript.aspx sample, it worked, but i dont understand the “Map1.GetMapParser().sendMarkersRequest()” part. Nowhere can i find info about Map1.GetMapParser(), so i dont know how it worked and thus can’t really make use of it.  Is there anywhere i can get info? 
  
 Ric

 Ric,


 In fact that’s a temporary solution. The method sendMarkersRequest() is one of our internal methods, we don’t have a proper client API for this scenario so we use one of the internal JavaScript function to solve it for now. That’s why you cannot find this API in our Client API white paper. We will create a better API for this scenario and make it released officially in the future version.
 
Generally, sendMarkersRequest()refreshes Markers in current extent at client side using callback. It sends the current status (like current extent) to server side, serialize them to JSON, pass it back to the client side, parse it and refresh the current status. 
 
Let us know for any queries.
 
 Ben

Ok, i’ll just wait for the next releases. Thanks.

Always my pleasure, Ric.