Select to view content in your preferred language

Memory leak issue of Graphic Layer

1064
3
02-09-2012 12:06 PM
hhhh
by
New Contributor
I have a test program. There are 2 buttons. One button is used for adding 2000 graphics, the second one is used for
clear all graphics.
  By monitoring the memory, I found the memory used is keeping increasing when I click "Add", "Clear", "Add", "Clear", .....

    Is there a way to solve the memeory leak?

   Thanks

if ((sender as Button).Name.Equals("btnClear"))
          {
              (dpMap.Layers["SelectionHighLightLayer"] as GraphicsLayer).Graphics.Clear();
              (dpMap.Layers["SelectionHighLightLayer"] as GraphicsLayer).ClearGraphics();
            
              GC.Collect();
              GC.GetTotalMemory(true);
              GC.WaitForPendingFinalizers();
          }
          else
          {
              ESRI.ArcGIS.Client.Geometry.Geometry geom = new MapPoint(-3105,5650533) ;

              for (int i = 0; i < 2000; i++)
              {
                  (dpMap.Layers["SelectionHighLightLayer"] as GraphicsLayer).Graphics.Add(new Graphic()
                                {
                                    Geometry = geom,
                                    Symbol = ResultsMarkerSymbol
                                });
              }
          }
0 Kudos
3 Replies
JenniferNery
Esri Regular Contributor
This may have already been fixed in v3.0 Beta 2.
You can download it from here: http://resourcesbeta.arcgis.com/en/webapis/silverlight-api/community/index.html

http://resourcesbeta.arcgis.com/en/webapis/silverlight-api/concepts/index.html#/What_s_new_in_3_0/01...
�?�Memory leak when calling Clear on child layers in a GroupLayer
0 Kudos
SuiHuang
Frequent Contributor
Hi Jennifer:

    Thank you for you information! When is v3.0 expected to be released? (I understand that the actual date is depending on the test result, but any related information will be helpful for us). Will it have a chance to be released at March?
    Fixing the memory leak issue is very important to us, if we cannot update to the release 3.0 soon, is there any previous version for us to rollback to temporarily, such that we can still avoid the memory leak? Will API 2.2 or 2.3 work?
    Thank you.

Sui

This may have already been fixed in v3.0 Beta 2.
You can download it from here: http://resourcesbeta.arcgis.com/en/webapis/silverlight-api/community/index.html

http://resourcesbeta.arcgis.com/en/webapis/silverlight-api/concepts/index.html#/What_s_new_in_3_0/01...
0 Kudos
JohanCarlsson
Regular Contributor
Hello,

I'm also very interested in this. We're currently using version 2.4 and have the same problem. Even deleting a layer does not free the memory and this is becoming a problem when the users run the application through Citrix. I don't know if this is related, but hiding a layer doesn't affect memory either. When Silverlight doesn't have to render as many vertices, shouldn't the memory usage decrease? Is there any way to solve this myself, through source code at GitHub or where is the code concering this located, if it's open?
0 Kudos