Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Memory issue #24

Open
ivanimr opened this issue Jan 5, 2018 · 6 comments
Open

Memory issue #24

ivanimr opened this issue Jan 5, 2018 · 6 comments
Assignees

Comments

@ivanimr
Copy link

ivanimr commented Jan 5, 2018

Hi @nixta,

Are you aware of any memory issues with this library? On every call of method +(AGSClusterLayer *)clusterLayerForFeatureTableLayer:(AGSFeatureTableLayer *)featureTableLayer the memory footprint of my app is increased by 9-10 megabytes which causes memory issues after multiple calls of this method. This method is called in our app whenever an item has been added to the map view - we refresh the map view and re-add all the layers, including the newly created clustering layer.
I've debugged this library and memory usage increases after -(void)addItems:(NSArray *)items has been called in method -(void)rebuildClusterGrid in -(void)dataLoadCompleted of -(void)featureLayerLoaded:(NSNotification *)notification.
Hope you can help me out.

Kind regards,
Ivan

@nixta
Copy link
Owner

nixta commented Jan 5, 2018

Hi @ivanimr. I wasn't aware, but to be honest I hadn't profiled this for memory use.

It's also been a loooong time since I've looked at this, so it might take me a while to spin up and get to figuring it out. But thanks for the info - that'll help a lot.

@nixta nixta self-assigned this Jan 8, 2018
@nixta
Copy link
Owner

nixta commented Jan 9, 2018

@ivanimr: Could you give me a little more info please?

  1. Are you clustering feature layers or a graphics layer?
  2. Where are the layers coming from? ArcGIS Online, your own server, or perhaps a Geodatabase locally on the device?
  3. Could you give me an indication of the number of layers and the number of features you're clustering here?
  4. Do you see the same pattern with the default sample app? I see a small increase, but nothing huge, however the profile of the sample app is to just add and cluster one or two layers, so quite different to your usage.

Just trying to get as much info as possible so that I can reproduce first before spending time following my way down the wrong path.

Thanks!

@ivanimr
Copy link
Author

ivanimr commented Jan 10, 2018

@nixta: Of course, I'll provide you with any info you need for this issue.

  1. I am using the newly added method clusterLayerForFeatureTableLayer for clustering a feature table layer (AGSFeatureTableLayer).

  2. The feature table layer is created from a feature table in the local Geodatabase so it's offline data.

  3. We are clustering only one feature table layer. This layer had about 400-500 features that have to be clustered.

  4. I haven't tested the sample app still, not sure if it would provide me any info though as I'm clustering the Geodatabase layer and it has a lot of features. I could test it out if you think it's viable.

Thanks a lot!

@nixta
Copy link
Owner

nixta commented Jan 10, 2018

Thanks @ivanimr.

I think taking the sample and just dropping your geodatabase layer in there in place of the demo layer to see if you still see the impact would be useful.

Separately, and hopefully I can avoid asking for this, would you be able to share the .geodatabase file if need be?

@ivanimr
Copy link
Author

ivanimr commented Jan 11, 2018

@nixta I would be able to share the .geodatabase file with a few modifications but I think I'm able to reproduce it with the geodatabase file from the sample app too with some code changes.
Let me explain you our workflow first. The iPad user has an interface in the app for manually adding features (he selects the location and enters some other info). This newly created feature is saved to the feature table of the .geodatabase file. In order for that feature to appear on the map along with already shown features, we first remove map layers (feature table layer and clustering layer) and then create a new feature table layer from the feature table in the .geodatabase file, setup the clustering layer again and add them both to the map view.
Please let me know if that's not a good approach.

I've simulated the same behavior in the sample app. I've attached the slightly edited controller of the sample app.
AGSSampleViewController.m.zip

Feature and clustering layer are added with a name and also removed with the same name in this file.
For testing purposes, I've changed the - (IBAction)toggleClustering method to no longer toggle clustering but instead to remove those two layers and add them again, similar as it is in our app. On toggling the "Clustering Enabled" in the sample app with this controller, you can see the memory footprint increase. Hope this helps!

@nixta
Copy link
Owner

nixta commented May 30, 2019

Hi @ivanimr. Really sorry that I dropped the ball on this! New job got the better of me.

I'm working on a new version for Runtime 100.x. See #22. Would that be of use to you?

Otherwise, did you manage to improve the memory issue at all?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants