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 problems to release my gdb in ArcGIS10. My tool works with an local gdb, but I failed to release it after the process. In Ag9.3 I can release it simply by Marshal.ReleaseComObject(workspace), but this doesn't work in AG10. Also releasing all FeatureCursors doesn't help. Only closing the whole application "deletes" the lock. Does anyone know how to release my gdb and "delete" the lock without closing the application?

share|improve this question
Search this site for "file geodatabase lock", some of those might help. –  Chad Cooper Oct 24 '11 at 11:47
Of course I searched the site before. But unfortunenatly none of the suggestions helped me out. I tried the Compact-GP, but this didn't unlock the gdb. It also doesn't seemed to be an orphaned lock, cause I cannot edit the gdb in ArcCatalog before I close my Application. But which object do I have to release for unlocking my gdb in addition to releasing the workspace? –  AnnemieK Oct 24 '11 at 12:41
From gis.stackexchange.com/questions/6230/…, it appears you may have run into a bug. If none of the answers below apply, I'd follow up with Esri tech support. –  matt wilkie Nov 2 '11 at 16:04

4 Answers 4

Getting to this condition is easy - all you need is one object that is holding a reference to something that needs the workspace to stay alive. Like a custom object that holds a Feature for example.

Once you are sure you hold no such references, try calling GC.collect() to force the garbage collector into a quasi-deterministic cleanup mode

share|improve this answer

I had a quick look and found information on the locking scenario you seem to be having. In ArcObjects 10 there is a SetWriteLock and FreeWriteLock option.

have a look at the forum link specifically the sample from Lance Shipman from Esri http://forums.arcgis.com/threads/36881-the-performance-fgdb-api-amp-arcobjects

Have Fun, CDB

share|improve this answer

If you are using cursors in your application make sure to use the ComReleaser to manage the lifetime of the cursors and destroy them when you are done with them. Otherwise they can lock your DBMS. I might be wrong but I don't thing calling ReleaseComObject on the workspace alone removes the reference to the cursors. Take a look at this ESRI blog post...


share|improve this answer

Found Idea from http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//003n0000007w000000

“These .lock files are removed whenever you run the geoprocessing Compact tool”

string[] lockfiles = Directory.GetFiles(project.Path, "*.lock",   SearchOption.AllDirectories);

if(lockfiles.Length > 0)
int lockCt = 0;
while (lockCt < lockfiles.Length)
 string inFGDB = System.IO.Path.GetDirectoryName(lockfiles[lockCt]);

 ESRI.ArcGIS.DataManagementTools.Compact compactProcess = new   ESRI.ArcGIS.DataManagementTools.Compact();

 compactProcess.in_workspace = inFGDB;

 geoprocessor.Execute(compactProcess ,null);

share|improve this answer

Your Answer


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

Not the answer you're looking for? Browse other questions tagged or ask your own question.