Select to view content in your preferred language

RefreshInterval for Feature Layer causes Application to run out of memory and crash

593
3
01-23-2024 12:07 PM
Labels (3)
ThomasMcMahon
Emerging Contributor

Hi,

I have run into an issue where when setting the RefreshInterval for a feature layer in our application, more memory is used up over time until the application crashes. I have been able to recreate the issue in a stand-alone project which I have attached.

 

0 Kudos
3 Replies
HamishDuff
Esri Contributor

Hi @ThomasMcMahon, thank you for your question. 

I was able to reproduce with the project you attached. However, when I tried to reproduce the crash in a new project using the ArcGIS WPF project template I could no longer reproduce the issue. 

I have attached a project which includes the code you were using in your main page. Could you try this project and let me know if you can still reproduce the issue?

0 Kudos
ThomasMcMahon
Emerging Contributor

Only reproduceable when building for x86, so thats why the new template project doesn't run into the issues. Running the viewer in a wpf window contained in an x86 application so need it to work in that  context.

0 Kudos
dotMorten_esri
Esri Notable Contributor

I ran both samples, and I do see the memory increase in both. The second doesn't crash because it runs x64, so there's a lot more headroom to work with. However, I see the memory leveling off somewhere around 1Gb and not climb any longer (without your code that allocates extra memory). I changed the refresh interval to 10s to really push the limit and ran for several hours, and memory did stop climbing (in fact it topped out at 1.2Gb then settled into 1Gb and stayed there).

I think what you're really hitting here is that you're loading a lot of data, and constantly refreshing all that data does require some memory to store and process. If you're going to display a significant amount of data and process it, I'd recommend you make sure your application runs as x64, since a 32bit .NET Framework process generally don't like you to exceed 1.2Gb of memory use. With the data and the processing itself required a good gigabyte of memory, it doesn't leave much room for the rest of your application.

0 Kudos