Select to view content in your preferred language

Memory Corruption error  of ArcObjects in multithreading environment

512
2
07-21-2010 07:52 AM
AnilDhiman
Deactivated User
In our program, we are trying to indentify differences between two different versions of Geodatabases

Inorder to increase the performance, we are trying to run Arcobjects in a multithreaded environment. We have created IWorkspaceFactory per thread

We are facing below mentioned error
The thread 'Win32 Thread' (0x2058) has exited with code 0 (0x0).
HEAP[KernUpdater.exe]: Heap block at 1C6D87B8 modified at 1C6D899C past requested size of 1dc
Windows has triggered a breakpoint in KernUpdater.exe.

Even though this error is random, it generally occurs when we are trying to do a
ITable.opentable or ITable.search or differenceCursor.next functions

This error crops up when these functions are invoked by different threads at the same time. We have ensured that the workspaces instances are not shared across threads, even though they are connecting to the same databases.

Can any one please help?
0 Kudos
2 Replies
KirkKuykendall
Deactivated User
Try following the pattern in the raster subset example, but instead of creating a thread for each raster band, create a thread for each table.
http://resources.esri.com/help/9.3/arcgisengine/dotnet/ViewCodePages/a520994c-1b3b-4036-a2ca-89dc763...
0 Kudos
AnilDhiman
Deactivated User
Thanks for the quick response

We may get functional errors if we create one thread per table.  In our application we are serializing the propertyset and then creating workspace at the thread level, but since the connection parameters are same for the threads, the same reference of workspace would be used...

I read this from ESRI documentation

"Workspaces are not singleton objects, but requesting a workspace with the same properties as an existing instance returns a reference to it (referred to as unique instancing)."

Is the shared workspace causing access violation exception?
0 Kudos