8-30 13:53:20.555: D/dalvikvm(26747): GC_CONCURRENT freed 2261K, 39% free 8878K/14407K, paused 2ms+3ms 08-30 13:53:20.766: D/dalvikvm(26747): GC_CONCURRENT freed 637K, 38% free 8981K/14407K, paused 2ms+3ms 08-30 13:53:20.993: D/dalvikvm(26747): GC_CONCURRENT freed 672K, 37% free 9083K/14407K, paused 2ms+4ms . . . 08-30 13:53:37.485: D/dalvikvm(26747): GC_CONCURRENT freed 709K, 39% free 8809K/14407K, paused 2ms+3ms 08-30 13:53:37.633: D/dalvikvm(26747): GC_CONCURRENT freed 715K, 39% free 8810K/14407K, paused 2ms+3ms 08-30 13:53:37.782: D/dalvikvm(26747): GC_CONCURRENT freed 717K, 39% free 8809K/14407K, paused 2ms+4ms 08-30 13:53:40.407: D/dalvikvm(26747): GC_CONCURRENT freed 2073K, 50% free 7332K/14407K, paused 5ms+3ms
Ok nevermind I managed to get this working.
I'll post what I did to make this work when I finish my work 😉
UPDATE
Ok so here's how i do it :
1. Parsing JSON string to get attributes and geometry, store them in an object.
2. Reproject if necessary to Web Mercator (102100) and create a Graphic object for
each item in the json file. Add it to a List of Graphics.
2. Write layer definition, with GeometryType, objectIdField, renderer and fields.
3. Create a FeatureSet, then setGraphics on it with the graphics created earlier
4. Instanciate an ArcGISFeatureLayer with the layer definition, the feature set, and options mode.
5. Simply add layer to map.
Ok, done. (I'll add details in some sort of tutorial if needed)
The problem now is GC (Garbage Collector).
I have a query where there are 3000 objects returned, geometry type : point.
To do all the things above, and also including the sql query, it takes around 1 second, which I would say is not bad considering the sql query, the json parsing, the generation of 3000 Graphics etc.
But next step is to actually showing the layer on the map. The layer does show up, and correctly, but after 15 to 20 seconds!8-30 13:53:20.555: D/dalvikvm(26747): GC_CONCURRENT freed 2261K, 39% free 8878K/14407K, paused 2ms+3ms 08-30 13:53:20.766: D/dalvikvm(26747): GC_CONCURRENT freed 637K, 38% free 8981K/14407K, paused 2ms+3ms 08-30 13:53:20.993: D/dalvikvm(26747): GC_CONCURRENT freed 672K, 37% free 9083K/14407K, paused 2ms+4ms . . . 08-30 13:53:37.485: D/dalvikvm(26747): GC_CONCURRENT freed 709K, 39% free 8809K/14407K, paused 2ms+3ms 08-30 13:53:37.633: D/dalvikvm(26747): GC_CONCURRENT freed 715K, 39% free 8810K/14407K, paused 2ms+3ms 08-30 13:53:37.782: D/dalvikvm(26747): GC_CONCURRENT freed 717K, 39% free 8809K/14407K, paused 2ms+4ms 08-30 13:53:40.407: D/dalvikvm(26747): GC_CONCURRENT freed 2073K, 50% free 7332K/14407K, paused 5ms+3ms
This takes 20 seconds and there are around 100 GC_CONCURRENT occurrences.
All of this happen just after adding the layer to the map.
I have no idea why. I understand that there are thousands of objects in memory, but I don't know what exactly the GC is collecting. I used MAT on Eclipse but nothing particular showed up.
Plus I don't understand why the GC doesn't free memory after showing the layer on the map.
So if you have any idea about this, feel free to reply 🙂
// path is location of json file public FeatureSet createWindTurbinesFeatureSet(String path) { FeatureSet fs = null; try { JsonFactory factory = new JsonFactory(); JsonParser parser = factory.createJsonParser(new FileInputStream(path)); parser.nextToken(); fs = FeatureSet.fromJson(parser); } catch (Exception e) { e.printStackTrace(); } return fs; }
This answer has been useful to a solution of mine that I am working on. Can anyone suggest here as to how to enable Identify on this layer. Can i give path of offline json file for the identify task service or is there some other approach. Kindly advise.
Thanks in advance.