In your application objects/Graphics are created and destroyed.
Now we recognize that the memory allocated by Esri::ArcGISRuntime::Graphic is not released.
So our application runs out of memory is a few hours (instead of running days and weeks)
I wrote a sample to reproduce the issue:
1) start the program
-> 185MB
2a) I create 100k objects (SimpleMarkerSymbol) -> exisiting objects: 100k:
-> 1008MB
2b) I destroy 100k objects (SimpleMarkerSymbol) -> exisiting objects: 0:
-> 1070MB
3a) create 100k objects..
3b) destroy..
-> exisiting objects: 0:
ctc 3981 15.7 7.2 3351616 1186460 pts/8 Sl+ 08:07 0:11 ./MemUsageWithManyMarker
-> 1180MB
4a) create 100k objects..
4b) destroy..
-> exisiting objects: 0:
ctc 3981 16.3 7.5 3404684 1233580 pts/8 Sl+ 08:07 0:23 ./MemUsageWithManyMarker
-> 1223MB
...
The memory isn´t released even if i destroy the a) the GraphicsOverlay, b) MapView or c) Map.
Following Cases/Bugs are created:
Hi Norbert, I hope you're well.
We'll take a look at your repro to try and understand what is going on. In the meantime, one thing which may be of use is to try and avoid creating a new SimpleMarkerSymbol for each Graphic that you allocate:
Esri::ArcGISRuntime::SimpleMarkerSymbol *sms =
new Esri::ArcGISRuntime::SimpleMarkerSymbol(Esri::ArcGISRuntime::SimpleMarkerSymbolStyle::Circle, QColor("red"), 10, graphic);
graphic->setSymbol(sms);
If you can create a SimpleRenderer for the GraphicsOverlay instead, then each Graphic in that overlay will get the same symbol without having to allocate additional memory. This should be a more efficient workflow in general - this sample should give you an idea of how to use that API arcgis-runtime-samples-qt/ArcGISRuntimeSDKQt_CppSamples/DisplayInformation/Simple_Renderer at master... .
I can see that this is a simplified repro project so if you are already doing that in the real example please ignore.
Luke
One other thing which may be worth trying is to make sure that individual graphics are removed when you loop round and call
glm->removeOne(graphic);
The call to remove a Graphic is asynchronous and you should wait for the graphicRemoved signal before removing the next. I'm not sure if that is affecting the work-flow that you use here but it may be worth investigation.
Hi Luke!
Is there an example how to create and destroy graphics as yopu suggested?
Thx