<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: arcgis javascript memory leak in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcgis-javascript-memory-leak/m-p/1038017#M72106</link>
    <description>&lt;P&gt;Not really, we just refresh the site when you move from a map page to any other page, which solves the problem.&amp;nbsp; It's not ideal but it works.&lt;/P&gt;</description>
    <pubDate>Thu, 18 Mar 2021 13:35:54 GMT</pubDate>
    <dc:creator>AndrewMurdoch1</dc:creator>
    <dc:date>2021-03-18T13:35:54Z</dc:date>
    <item>
      <title>arcgis javascript memory leak</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcgis-javascript-memory-leak/m-p/22820#M1967</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm trying&amp;nbsp;use client-side feature layer to display tweenty thounds polygon on map, i need add/remove layer frenquenly, i found when a add some layer then remove all of it, chrome memory usage only decrese a small part of it increase.&amp;nbsp;&lt;/P&gt;&lt;P&gt;there is some code of my app:&lt;/P&gt;&lt;P&gt;create map and mapview:&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;cosnt map = &lt;SPAN style="color: #cc7832; font-weight: bold;"&gt;new &lt;/SPAN&gt;Map({
&amp;nbsp; &lt;SPAN style="color: #9876aa;"&gt;basemap&lt;/SPAN&gt;: &lt;SPAN style="color: #6a8759;"&gt;'osm'
&lt;/SPAN&gt;})
&lt;SPAN style="color: #cc7832; font-weight: bold;"&gt;const &lt;/SPAN&gt;mapView = &lt;SPAN style="color: #cc7832; font-weight: bold;"&gt;new &lt;/SPAN&gt;MapView({
&amp;nbsp; &lt;SPAN style="color: #9876aa;"&gt;container&lt;/SPAN&gt;: &lt;SPAN style="color: #6a8759;"&gt;'viewDiv'&lt;/SPAN&gt;&lt;SPAN style="color: #cc7832;"&gt;,
&lt;/SPAN&gt;&lt;SPAN style="color: #cc7832;"&gt;&amp;nbsp; &lt;/SPAN&gt;map&lt;SPAN style="color: #cc7832;"&gt;,
&lt;/SPAN&gt;&lt;SPAN style="color: #cc7832;"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #9876aa;"&gt;center&lt;/SPAN&gt;: [xx, yy]&lt;SPAN style="color: #cc7832;"&gt;,
&lt;/SPAN&gt;&lt;SPAN style="color: #cc7832;"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #9876aa;"&gt;zoom&lt;/SPAN&gt;: &lt;SPAN style="color: #6897bb;"&gt;5
&lt;/SPAN&gt;})&lt;/PRE&gt;&lt;P&gt;add layer:&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;SPAN style="color: #cc7832; font-weight: bold;"&gt;const &lt;/SPAN&gt;graphics = _.&lt;SPAN style="color: #ffc66d;"&gt;map&lt;/SPAN&gt;(grids&lt;SPAN style="color: #cc7832;"&gt;, &lt;/SPAN&gt;(grid) =&amp;gt; ({
&amp;nbsp; &lt;SPAN style="color: #9876aa;"&gt;geometry&lt;/SPAN&gt;: &lt;SPAN style="color: #cc7832; font-weight: bold;"&gt;new &lt;/SPAN&gt;Polygon({
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="color: #9876aa;"&gt;hasZ&lt;/SPAN&gt;: &lt;SPAN style="color: #cc7832; font-weight: bold;"&gt;false&lt;/SPAN&gt;&lt;SPAN style="color: #cc7832;"&gt;,
&lt;/SPAN&gt;&lt;SPAN style="color: #cc7832;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #9876aa;"&gt;hasM&lt;/SPAN&gt;: &lt;SPAN style="color: #cc7832; font-weight: bold;"&gt;false&lt;/SPAN&gt;&lt;SPAN style="color: #cc7832;"&gt;,
&lt;/SPAN&gt;&lt;SPAN style="color: #cc7832;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #9876aa;"&gt;rings&lt;/SPAN&gt;: grid.ring
&amp;nbsp; })&lt;SPAN style="color: #cc7832;"&gt;,
&lt;/SPAN&gt;&lt;SPAN style="color: #cc7832;"&gt;
&lt;/SPAN&gt;&lt;SPAN style="color: #cc7832;"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #9876aa;"&gt;attributes&lt;/SPAN&gt;: {
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="color: #9876aa;"&gt;ObjectID&lt;/SPAN&gt;: grid.&lt;SPAN style="color: #9876aa;"&gt;id&lt;/SPAN&gt;
&amp;nbsp; }
}))

&lt;SPAN style="color: #cc7832; font-weight: bold;"&gt;const &lt;/SPAN&gt;layer = &lt;SPAN style="color: #cc7832; font-weight: bold;"&gt;new &lt;/SPAN&gt;FeatureLayer({
&amp;nbsp; &lt;SPAN style="color: #9876aa;"&gt;source&lt;/SPAN&gt;: graphics&lt;SPAN style="color: #cc7832;"&gt;,&lt;/SPAN&gt;&lt;SPAN style="color: #808080;"&gt;
&lt;/SPAN&gt;&lt;SPAN style="color: #808080;"&gt;&amp;nbsp; &lt;/SPAN&gt;fields&lt;SPAN style="color: #cc7832;"&gt;, &lt;/SPAN&gt;&lt;SPAN style="color: #808080;"&gt;
&lt;/SPAN&gt;&lt;SPAN style="color: #808080;"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #9876aa;"&gt;objectIdField&lt;/SPAN&gt;: &lt;SPAN style="color: #6a8759;"&gt;'ObjectID'&lt;/SPAN&gt;&lt;SPAN style="color: #cc7832;"&gt;,&lt;/SPAN&gt;&lt;SPAN style="color: #808080;"&gt;
&lt;/SPAN&gt;&lt;SPAN style="color: #808080;"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #9876aa;"&gt;renderer&lt;/SPAN&gt;: renderer&lt;SPAN style="color: #cc7832;"&gt;, &lt;/SPAN&gt;&lt;SPAN style="color: #808080;"&gt;
&lt;/SPAN&gt;&lt;SPAN style="color: #808080;"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #9876aa;"&gt;popupTemplate&lt;/SPAN&gt;: pTemplate
})
 map.&lt;SPAN style="color: #ffc66d;"&gt;add&lt;/SPAN&gt;(layer)&lt;/PRE&gt;&lt;P&gt;clear layer:&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;map.removeAll()&lt;/PRE&gt;&lt;P&gt;I found if i not create MapView(only create Map, and add/remove layer on map) it works fine, does it means i miss call some method on MapView to clear?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;============== Update =================&lt;/P&gt;&lt;P&gt;i debug use chrome dev tool memory snapshot, i found when i add then remove layer, there a some object left, e.g. 4.9/esri/layers/graphics/data/DefaultSpatialIndex.js file _.featuresById field, the clean method not called.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Dec 2021 20:55:44 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcgis-javascript-memory-leak/m-p/22820#M1967</guid>
      <dc:creator>weili7</dc:creator>
      <dc:date>2021-12-10T20:55:44Z</dc:date>
    </item>
    <item>
      <title>Re: arcgis javascript memory leak</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcgis-javascript-memory-leak/m-p/22821#M1968</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Wei,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;So the question I have if if you need to add and remove layer from your map then why are you using const for that layer? Because even if you remove the layer you can not reassign that layer with new data or set it to null to clear the memory used by that layer.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 11 Oct 2018 12:41:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcgis-javascript-memory-leak/m-p/22821#M1968</guid>
      <dc:creator>RobertScheitlin__GISP</dc:creator>
      <dc:date>2018-10-11T12:41:32Z</dc:date>
    </item>
    <item>
      <title>Re: arcgis javascript memory leak</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcgis-javascript-memory-leak/m-p/22822#M1969</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Also keep in mind that by &lt;EM&gt;not&lt;/EM&gt; creating the MapView, you are not creating the canvas to draw the layer in WebGL in the browser, this will save lots of memory, but of course, you can't see the map. Fetching and rendering the data is where most of the memory usage comes in.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 11 Oct 2018 13:37:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcgis-javascript-memory-leak/m-p/22822#M1969</guid>
      <dc:creator>ReneRubalcava</dc:creator>
      <dc:date>2018-10-11T13:37:26Z</dc:date>
    </item>
    <item>
      <title>Re: arcgis javascript memory leak</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcgis-javascript-memory-leak/m-p/22823#M1970</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp; Sorry for let you misunderstanding, the add layer code is in a Promise.then code block, the layer only reference by map.layers. I try comment map.add(layer), the memory increase then decrease to previous value, i also try comment create MapView code, only create Map, it behavior same as comment map.add(layer). So i'm confusing should i to clear layerViews on MapView instance?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 11 Oct 2018 13:38:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcgis-javascript-memory-leak/m-p/22823#M1970</guid>
      <dc:creator>weili7</dc:creator>
      <dc:date>2018-10-11T13:38:37Z</dc:date>
    </item>
    <item>
      <title>Re: arcgis javascript memory leak</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcgis-javascript-memory-leak/m-p/22824#M1971</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp; Thank you for you response, i'm confusing on why when i delete layer, the memory usage not decrease to before i create layer. In my case, i create 20,000 square on same feature layer, chrome dev tools show memory usage increase from 50M to 250M, then i delete this layer, memory usage decrease from 250M to 150M, there are 100M memory delta, i want figure out why this 100M not be collect by gc.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 11 Oct 2018 13:42:57 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcgis-javascript-memory-leak/m-p/22824#M1971</guid>
      <dc:creator>weili7</dc:creator>
      <dc:date>2018-10-11T13:42:57Z</dc:date>
    </item>
    <item>
      <title>Re: arcgis javascript memory leak</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcgis-javascript-memory-leak/m-p/22825#M1972</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;We're also seeing this issue.&amp;nbsp; We have a SPA and as we&amp;nbsp;repaint the DOM with a new view, the old map memory is retained by the browser.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 08 Jul 2019 13:07:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcgis-javascript-memory-leak/m-p/22825#M1972</guid>
      <dc:creator>BrianChristensen</dc:creator>
      <dc:date>2019-07-08T13:07:05Z</dc:date>
    </item>
    <item>
      <title>Re: arcgis javascript memory leak</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcgis-javascript-memory-leak/m-p/22826#M1973</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This is still an issue, if we navigate away from the maps the memory isn't getting free'd, it looks like the MapView isn't destroying itself properly.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 12 Aug 2020 21:52:31 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcgis-javascript-memory-leak/m-p/22826#M1973</guid>
      <dc:creator>AndrewMurdoch1</dc:creator>
      <dc:date>2020-08-12T21:52:31Z</dc:date>
    </item>
    <item>
      <title>Re: arcgis javascript memory leak</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcgis-javascript-memory-leak/m-p/1038013#M72105</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/51173"&gt;@AndrewMurdoch1&lt;/a&gt;&amp;nbsp;did you ever find a solution to this?&amp;nbsp; I think I'm running into the same exact problem.&lt;/P&gt;</description>
      <pubDate>Thu, 18 Mar 2021 13:31:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcgis-javascript-memory-leak/m-p/1038013#M72105</guid>
      <dc:creator>NilsBabel1</dc:creator>
      <dc:date>2021-03-18T13:31:18Z</dc:date>
    </item>
    <item>
      <title>Re: arcgis javascript memory leak</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcgis-javascript-memory-leak/m-p/1038017#M72106</link>
      <description>&lt;P&gt;Not really, we just refresh the site when you move from a map page to any other page, which solves the problem.&amp;nbsp; It's not ideal but it works.&lt;/P&gt;</description>
      <pubDate>Thu, 18 Mar 2021 13:35:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcgis-javascript-memory-leak/m-p/1038017#M72106</guid>
      <dc:creator>AndrewMurdoch1</dc:creator>
      <dc:date>2021-03-18T13:35:54Z</dc:date>
    </item>
    <item>
      <title>Re: arcgis javascript memory leak</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcgis-javascript-memory-leak/m-p/1038046#M72107</link>
      <description>&lt;P&gt;Thanks Andrew, I just saw your other post communicating with Andy Gup.&amp;nbsp; I've been communicating with him too.&amp;nbsp; In my case refreshing the page is not exactly what I want to do.&amp;nbsp; I have successfully created a service to build the map view.&amp;nbsp; When a user navigates to the map page they should get a a new map view if it's their first time or the existing one from the service if they are returning there.&amp;nbsp; I have a github repo doing this that you can check out.&amp;nbsp;&amp;nbsp;&lt;A href="https://github.com/nbabel/MapView-service" target="_blank"&gt;https://github.com/nbabel/MapView-service&lt;/A&gt;&amp;nbsp; In this repo it works and there is not a memory leak.&amp;nbsp; That is, the map component gets flushed properly on ngOnDestroy.&amp;nbsp; However, this is just a sample that doesn't really do much.&amp;nbsp; In my full application I have many layers, graphics, widgets, popups, etc.&amp;nbsp; Even though I'm using the service the same exact way it doesn't flush the previous map view properly.&amp;nbsp; I think there must be something I've created that holds on to the view or the DOM node.&amp;nbsp; I'm going through the painful process of trying to determine that now.&amp;nbsp; Do you have additional items (widgets, layers, etc.) in your view?&lt;/P&gt;</description>
      <pubDate>Thu, 18 Mar 2021 13:58:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcgis-javascript-memory-leak/m-p/1038046#M72107</guid>
      <dc:creator>NilsBabel1</dc:creator>
      <dc:date>2021-03-18T13:58:25Z</dc:date>
    </item>
    <item>
      <title>Re: arcgis javascript memory leak</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcgis-javascript-memory-leak/m-p/1038062#M72108</link>
      <description>&lt;P&gt;You're describing exactly what our problem is!&amp;nbsp; We have several areas where we build up rather complex maps with thousands of sections and assets on them, including Widgets, and no matter what I flush, free, null, destroy or delete, we always have ~100 - 200 MB of memory kicking around from each map, that I can't get rid of.&lt;BR /&gt;&lt;BR /&gt;In most cases this isn't an issue because people don't use our software long enough or cycle through enough maps to create an issue, but it's 100 - 200 MB each time you visit a map, so if you work with the maps for a couple hours and cycle them 10 - 15 times, you're easily holding 1GB - 2GB of memory that we have no way to free.&lt;BR /&gt;&lt;BR /&gt;If you come up with a solution please let me know, because apart from refreshing the site I don't know what to do.&amp;nbsp; I'll take a look at your example, but I suspect I'm doing exactly the same thing - &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;BR /&gt;&lt;BR /&gt;Cheers&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 18 Mar 2021 14:24:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcgis-javascript-memory-leak/m-p/1038062#M72108</guid>
      <dc:creator>AndrewMurdoch1</dc:creator>
      <dc:date>2021-03-18T14:24:54Z</dc:date>
    </item>
    <item>
      <title>Re: arcgis javascript memory leak</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcgis-javascript-memory-leak/m-p/1038076#M72109</link>
      <description>&lt;P&gt;Your map-service is doing the same thing our esri-service is doing, so at least we approached the problem from the same angle!&lt;/P&gt;</description>
      <pubDate>Thu, 18 Mar 2021 14:35:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcgis-javascript-memory-leak/m-p/1038076#M72109</guid>
      <dc:creator>AndrewMurdoch1</dc:creator>
      <dc:date>2021-03-18T14:35:32Z</dc:date>
    </item>
    <item>
      <title>Re: arcgis javascript memory leak</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcgis-javascript-memory-leak/m-p/1038114#M72111</link>
      <description>&lt;P&gt;Thanks Andrew, at least I know I'm not crazy.&amp;nbsp; I only really determined it was a problem because I noticed each time the user went back to the map the performance of the map was degraded.&amp;nbsp; Also, if I repeatedly test going back and forth to the map eventually (~10-15 visits) I get a webGL error (number of webGL contexts has reached it's limit, the last context will be lost).&amp;nbsp; So it's not just that the map view is kept in memory but there is a webGL context for each map view.&amp;nbsp; Another very odd thing I noticed is I have an identify task and I walked through the code for when you click the map.&amp;nbsp; The identify task gets called once for each map component I&amp;nbsp; built.&amp;nbsp; So if I have gone back to my map page three times the identify task gets called three times for each click.&amp;nbsp; So it seems the 'old' map views don't actually go away.&amp;nbsp; They still have a webGL context and are still there even though you don't see them in the DOM.&amp;nbsp; Any ideas on how to communicate this to esri?&amp;nbsp; It seems like it should be something on their end and we shouldn't be jumping through hoops to try and fix this.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 18 Mar 2021 15:38:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcgis-javascript-memory-leak/m-p/1038114#M72111</guid>
      <dc:creator>NilsBabel1</dc:creator>
      <dc:date>2021-03-18T15:38:34Z</dc:date>
    </item>
    <item>
      <title>Re: arcgis javascript memory leak</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcgis-javascript-memory-leak/m-p/1038121#M72112</link>
      <description>&lt;P&gt;Well you've been talking with Andy whose fairly responsive, and that's good!&amp;nbsp; I know at a few other ESRI dev's know about this, and I've given them a couple test repo's to demonstrate the issue, so I'm not sure what else we can do.&lt;BR /&gt;&lt;BR /&gt;Apart from refreshing, which is certainly not ideal, I think we're stuck until they figure out a solution on their end.&lt;/P&gt;</description>
      <pubDate>Thu, 18 Mar 2021 15:46:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcgis-javascript-memory-leak/m-p/1038121#M72112</guid>
      <dc:creator>AndrewMurdoch1</dc:creator>
      <dc:date>2021-03-18T15:46:19Z</dc:date>
    </item>
    <item>
      <title>Re: arcgis javascript memory leak</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcgis-javascript-memory-leak/m-p/1038885#M72141</link>
      <description>&lt;P&gt;Hey&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/51173"&gt;@AndrewMurdoch1&lt;/a&gt;&amp;nbsp;I've made some progress on the memory leak in my app.&amp;nbsp; I've successfully gotten the view to completely destroy.&amp;nbsp; When the user goes back to the map component it displays the existing map view and there is only one object in the memory snapshot.&amp;nbsp;&lt;/P&gt;&lt;P&gt;On ngOnDestroy I had to destroy, remove, and nullify everything that contains any reference to the map view.&amp;nbsp; For widgets I run destroy() and&amp;nbsp; make null.&amp;nbsp; Some objects besides widgets retain a reference to the view somehow also.&amp;nbsp; I create a PortalBasemapSource and even though there is no reference to the view I had to destroy and make it null also.&amp;nbsp; I think anything in the API that you create with the new keyword should be destroyed and made null.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I also created and event handler for every event (.on(...)) I've created on the view, widgets, and watchUtils.&amp;nbsp; Then in ngOnDestroy I call remove() on all the handlers.&amp;nbsp; It was a brutal effort of trial and error but in this case I've got it working.&amp;nbsp; I guess this makes sense.&amp;nbsp; I think the api is doing what it is supposed to.&amp;nbsp; I think it's more of an issue with angular/javascript garbage collection.&amp;nbsp;&amp;nbsp;Not sure how many things you have going on in your map but if you can destroy them or remove them onDestroy than you may be able to fix your memory leak.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;As an extra tidbit I'm using the Angular Material Drag and Drop Directive (&lt;A href="https://material.angular.io/cdk/drag-drop/overview" target="_blank"&gt;https://material.angular.io/cdk/drag-drop/overview&lt;/A&gt;).&amp;nbsp; At version 8.2.3 it has a memory leak in the dragboundary property (&lt;A href="https://github.com/angular/components/issues/17255" target="_blank"&gt;https://github.com/angular/components/issues/17255&lt;/A&gt;).&amp;nbsp; Took me a while to figure that out since I'm putting my widgets in a div that the user can drag around.&amp;nbsp; You might check that too, if you are using it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Good luck!&lt;/P&gt;</description>
      <pubDate>Fri, 19 Mar 2021 21:50:56 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcgis-javascript-memory-leak/m-p/1038885#M72141</guid>
      <dc:creator>NilsBabel1</dc:creator>
      <dc:date>2021-03-19T21:50:56Z</dc:date>
    </item>
    <item>
      <title>Re: arcgis javascript memory leak</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcgis-javascript-memory-leak/m-p/1039102#M72144</link>
      <description>&lt;P&gt;I'll try that on my end, I was doing some similar in 4.15 / 4.16 of the ArcGIS lib, but maybe things got better in 4.17+.&lt;BR /&gt;&lt;BR /&gt;Thanks for the tip!&lt;BR /&gt;&lt;BR /&gt;Cheers&lt;/P&gt;</description>
      <pubDate>Sun, 21 Mar 2021 18:51:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcgis-javascript-memory-leak/m-p/1039102#M72144</guid>
      <dc:creator>AndrewMurdoch1</dc:creator>
      <dc:date>2021-03-21T18:51:40Z</dc:date>
    </item>
    <item>
      <title>Re: arcgis javascript memory leak</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcgis-javascript-memory-leak/m-p/1050224#M72697</link>
      <description>&lt;P&gt;Sorry, I totally spaced on this ticket!&amp;nbsp; I changed our code over to use ArcGIS Core from:&lt;BR /&gt;&lt;BR /&gt;&lt;A href="https://github.com/Esri/jsapi-resources/tree/master/esm-samples" target="_blank"&gt;https://github.com/Esri/jsapi-resources/tree/master/esm-samples&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;I used that to create this example:&lt;BR /&gt;&lt;BR /&gt;&lt;A href="https://github.com/docmur/angular-core-esri" target="_blank"&gt;https://github.com/docmur/angular-core-esri&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;I accidentally left it running for 60 hours last weekend and overall the memory was fine.&amp;nbsp; It grabbed a little for the map, but otherwise didn't grab anymore.&lt;BR /&gt;&lt;BR /&gt;Take a look and see if you can make it work &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 22 Apr 2021 18:10:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcgis-javascript-memory-leak/m-p/1050224#M72697</guid>
      <dc:creator>AndrewMurdoch1</dc:creator>
      <dc:date>2021-04-22T18:10:49Z</dc:date>
    </item>
    <item>
      <title>Re: arcgis javascript memory leak</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcgis-javascript-memory-leak/m-p/1110405#M75062</link>
      <description>&lt;P&gt;I know this an old post, but I got it!&amp;nbsp;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;1. Look at &lt;A href="https://github.com/epaitz/jsapi-angular-ngrx-ds2021" target="_blank"&gt;https://github.com/epaitz/jsapi-angular-ngrx-ds2021&lt;/A&gt;&lt;BR /&gt;2. I took that code and made:&amp;nbsp; &lt;A href="https://github.com/docmur/angular-core-esri" target="_blank"&gt;https://github.com/docmur/angular-core-esri&lt;/A&gt; (Look at master-a12)&lt;BR /&gt;3. When you allocate a map, store it's "settings" in a Store (map, view, feature layers, etc…)&lt;BR /&gt;4. When you recall the map, don't allocate a new feature layer, just remove and add the features to the existing layer(s) if you need to change the layer or features.&lt;BR /&gt;5.&amp;nbsp; That code is using a single map and view, then changing the features in the layer, but the same idea works for multiple maps.&lt;BR /&gt;6.&amp;nbsp; Don't try and destroy the map or view, or feature layer, you won't reclaim memory doing that.&lt;BR /&gt;&lt;BR /&gt;For some reason the featureLayer.destroy(), and map.removeAll() / map.layers.removeAll(), won't free the memory being held by the feature layer, which is why it continues to climb.&amp;nbsp; I've already rolled this code into our production application, and it works wonderfully!&amp;nbsp; We allocate 2 maps in total, and then just hold them in the Store, being recalled when we need them, then I use the feature layer to apply edits to do the main work.&lt;BR /&gt;&lt;BR /&gt;The multiple map variation has been able to run for 20+ hours with no issue and using ~35MB of memory from the Dev Console.&lt;BR /&gt;&lt;BR /&gt;This is the solution you're probably looking for &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;BR /&gt;&lt;BR /&gt;Cheers&lt;/P&gt;</description>
      <pubDate>Fri, 22 Oct 2021 19:59:23 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcgis-javascript-memory-leak/m-p/1110405#M75062</guid>
      <dc:creator>AndrewMurdoch1</dc:creator>
      <dc:date>2021-10-22T19:59:23Z</dc:date>
    </item>
    <item>
      <title>Re: arcgis javascript memory leak</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcgis-javascript-memory-leak/m-p/1113603#M75156</link>
      <description>&lt;P&gt;Thanks a lot.&amp;nbsp; I'll take a look.&lt;/P&gt;</description>
      <pubDate>Wed, 03 Nov 2021 14:23:31 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcgis-javascript-memory-leak/m-p/1113603#M75156</guid>
      <dc:creator>NilsBabel1</dc:creator>
      <dc:date>2021-11-03T14:23:31Z</dc:date>
    </item>
  </channel>
</rss>

