Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I have created a class library which does some geoprocessing. The addin calls a class that is an async process. I have ensured the thread is STA and the arcobjects are thread safe (ie. not passed from the addin). All arcobjects are created within the thread.

Because this is a class library I wrapped it in a winforms UI and also as an addin. Both sets of code are exactly the same and test were performed using the exact same data. Both the winforms and addin complete the code with the desired results and no memory leaks are evident. For the case of the addin there is no interaction with the map period at this point and there are no mapping or display elements in the winforms code either.

the only UI updates are the update of a progress dialog in both the addin and UI. The addin is using a dockable window (user control ui).

The issue I am seeing is when the library is called from the addin, code execution is 5x slower than the same code called through the winforms application.

Any ideas on where I might look to see why this is occurring?

share|improve this question
    
Are you using any arcobjects singletons? –  Kirk Kuykendall Mar 18 '13 at 15:35
    
Yes, a quick look at the list and I am using a few workspacefactory objects to open my featureclasses independant of ArcMap so they are created within the thread. I am creating two workspacefactories (for my input and output) then looping and caching data locally using an inmemmoryworkspace which I use a factory to create. Should I create the inmemoryworkspacefactory only once? I should mention the code doesn't fail and is slow only when executed within the addin. –  Justin Carasick Mar 18 '13 at 15:47
    
Are you creating using Activator.CreateInstance, or with new ? –  Kirk Kuykendall Mar 18 '13 at 15:51
    
I am (or was) using the new. I am updating now to try the Activator.CreateInstance method. –  Justin Carasick Mar 18 '13 at 15:55
    
I updated the code (thanks for pointing that out) but don't see a real difference with the update. –  Justin Carasick Mar 18 '13 at 17:25
show 2 more comments

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.