Memory build on featureLayer.setDefinitionExpression in Map view

817
5
09-27-2021 11:39 PM
KarthiSivalingam
New Contributor III
Hi,
A FeatureLayer is created using ServiceFeatureTable  and added and on Map view. On some user flows  setting featurelayer definition expression using featureLayer.setDefinitionExpression(). It is observed that for every such API call the additional memory is consumed which is never released, leading to eventual crash of application.  

Environment:
OS : Windows 10
ArcGIS Runtime SDK 100.11.2 and ArcGIS Runtime SDK 100.12
JDK : Open JDK11.0.12+7

Thanks,

Karthi

 

0 Kudos
5 Replies
MarkBaird
Esri Regular Contributor

@KarthiSivalingam can you send me the console output you are getting when the application crashes?  It would help me to see the details of this.

I'm currently running a modified version of your app which is hitting that toggle button 4 times a second to see if I'm able reproduce the crash.

I've not managed to get it to crash yet (after 2 hours), but I'm seeing the memory usage of the JVM go up very slightly, but given the allocation and deallocation of resources happening in the background I'd expect this.  When resources are deallocated in Java, you won't see an immediate drop in memory usage; this is managed by the garbage collection in the JVM.  The JVM should free up resources eventually.

I've had a quick look at your code and I can't see any issues with what you are doing here.

Send me some more details of the crash and I'll look into this.  It certainly shouldn't be crashing.

 

 

0 Kudos
MarkBaird
Esri Regular Contributor

Just an update on this, I've had the modified version of your app running for about 4 hours now and memory usage has been very stable at about 670mb and isn't going up (it crept up initially, but stabilised).  This app has been hitting the toggle button every 250ms for the entire time.

I'll leave it running for a bit longer, but to investigate this further I'm going to need some more information on crash you've seen.  Console output / crash dump and any details about how you've configured the JVM if you've made any changes from default.

0 Kudos
KarthiSivalingam
New Contributor III

Hi , Thanks for checking it. In my environment, I have modified to hit the toggle every 250ms and kept it for an hour. Memory usage reached to 1.3GB. The crash is observed in my client's environment, I am trying to collect the crash dump from them. 

Thanks ,

Karthi

0 Kudos
MarkBaird
Esri Regular Contributor

@KarthiSivalingam you say it reached 1.3GB, but was it a stable 1.3Gb or was it still going up?  Are you able to reproduce the crash in your own environment?

Memory management of a Java application isn't like a C++ app where resources are freed up as soon as they are deallocated.  In a Java app, resources are only freed up when garbage collection happens.  This is something which is controlled by the JVM and cannot be predicted.  Garbage collection is an expensive operation, so the JVM may not run it if it feels that system resources are not running out.  

If you can get me the console output from the crash and any logs I can look at this.  When you say "crash", did the the JVM actually crash?

 

 

0 Kudos
KarthiSivalingam
New Contributor III

@MarkBaird , I have re-ran it for longer time (around 6hrs) , Memory usage went up to 1.7GB and it was hovering around that. But it is not crashing in my environment. It was observed in my client's environment and I am trying to get the crash log from them. I will share it once received.

 Thanks ,

Karthi

0 Kudos