Issues with ArcObjects and ArcGIS 10.1 SP1 IDataStatistics

4353
14
11-21-2012 03:49 AM
DavidWilton
Occasional Contributor
I currently have a case open with ESRI helping us to resolve this. I'm posting here because of the large amount of time it took to find this issue to help others. I have been experiencing a significant number of seemingly random crashes with ArcGIS 10.1 SP1. The issue has been narrowed down to IDataStatistics and IEnumerator (you must loop through the statistics with the enum to cause issue). Running statistics more than once (on different layers or the same layer) can cause a complete crash of ArcMap. It is random as to how many uses of IDataStatistics  will cause the crash, often three or four uses but sometimes as many as 100 which gives the error its random nature. It also causes strange issues with the UI, in the sample code the values are added to a list view which will suddenly switch to foreign characters. Errors we have received since updating to SP1 include System.AccessViolationException (Attempted to read write protected memory), 'FatalExecutionEngineError', 'Assert Failure' and �??ExecutionEngineException�?�. Tested on 32 and 64bit versions of Windows 7 and 32 bit XP

Tested the code without SP1 and it is fine. We have submitted this to ESRI UK and we are awaiting feedback.

Paste bin of the test code submitted to ESRI UK
http://pastebin.com/A4cuQc2u

Has anyone else working with ArcObjects been receiving issues? I will post back when ESRI do

Dave
0 Kudos
14 Replies
DubravkoAntonic
New Contributor III
Read your code and i have some hints.

Use FeatureClass.Search  with Cursor recycling
Release object after use with ReleaseComObject rather then FinalRelease

http://help.arcgis.com/en/sdk/10.0/arcobjects_net/conceptualhelp/index.html#/Releasing_COM_reference...

If you run a lot of iteration with enum without using Recycling you can waste a lot of memory.
Try this wit enclosing your loop in try catch and while running look monitor you system memory.

Hope this helps.

Sorry don't have time to do some testing on my side but will try to do that next week.

Regards, Dubravko
0 Kudos
DavidWilton
Occasional Contributor
Dubravko,

              Thanks I tried both (recyling true and ReleaseComObject) and it still crashed. The code is in a try catch but the error is never caught. Also still getting very strange issues on the UI, notice all of the foreign characters in the image which are not in the data, none of which happened prior to SP1.

[ATTACH=CONFIG]19477[/ATTACH]

Thanks for your suggestions.

Dave
0 Kudos
DubravkoAntonic
New Contributor III
Dave,

I tested your code and I'm sure that in ESRI imeplementation of IDataStatistics or in combination with IEnumerator is a memory leak. I separated AO logic from form object and after looping 10000 times in FeatureClass with 1500 features I had 300Mb RAM memory less. Isn't so bad if you do it once or twice but in some SOE implementation will be some nasty experience.

I run same loop with normal Cursor and there is no problem but you can make this analysis of unique value in Db or you can make your own implementation using System.Data.DataTable object or you can make your own and you'll be sure that you don't have this leaks.

Sorry for bad news but same on my side. Hope ESRI will do something about it in a reasonable time.

Regards, Dubravko
0 Kudos
DavidWilton
Occasional Contributor

I'm sure that in ESRI imeplementation of IDataStatistics or in combination with IEnumerator is a memory leak.


Dubravko,
thanks for checking that and confirming. Good call on separating out the UI from the project. I have a case open with ESRI and I'm sure this wasn't an issue before SP1 so hopefully they will recognise and resolve. It makes our application crash all the time as we rely heavily on IDataStatistics. As you say maybe I should look to create a work around.

Thanks again.

Dave
0 Kudos
DubravkoAntonic
New Contributor III
I tested on ArcMap 10.0 SP4, WinXP.
If you need help about some implementation let me know on private, to help you in my spare , night :cool:, time.

Regards Dubravko
0 Kudos
DavidWilton
Occasional Contributor
Seems I missed this post, other people are experiencing the same issue:

http://forums.arcgis.com/threads/70997-ICursor-issue-in-10.1-SP-1
0 Kudos
DavidWilton
Occasional Contributor
Esri inc have confirmed that there is a bug in 10.1 SP1:

Bug is NIM087476 �??Memory leakage ESRI.ArcGIS.Geodatabase.IDataStatistics using UniqueValues property with ArcGIS 10.1 with SP1�?�
0 Kudos
EricMcPhee
New Contributor III
I tried searching for this bug, but cannot find it. Where is it?
0 Kudos
DavidWilton
Occasional Contributor
I tried searching for this bug, but cannot find it. Where is it?


I just asked ESRI the same question. Here is the response I got:

It will not show straight away.

When a bug is raised it is only visible by the support team in the US initially and then once the development team that will actually fix the code has verified it then it will be marked to be visible by others.

This can take varying amounts of time as if they are trying to investigate workarounds etc it may not be visible until they have finished the in-depth investigation.
0 Kudos