process can't access the file 'a0000000a.freelist',its being used by another process

989
2
12-16-2013 09:09 PM
LalitArora
New Contributor III
HI

I'm migrating code from 9.3.1 to 10.2

I got below error while testing, it was working perfectly in 9.3.1.

---------------------------
Error
---------------------------
ErrorDescription:The process cannot access the file 'a0000000a.freelist' because it is being used by another process.
---------------------------

To reproduce this

1. Create a File GDB
2. Create dataset
3. create 4-5 feature classes in dataset
3. create a geometric network using INetworkLoader3 --> LoadNetwork for these feature classes within dataset.
4. Delete geometric network by looping EnumDataset within FGDB.
5. Release memory of all COM objects.
6. On deleting File GDB this error is coming. Seems after deleting the geometric network it still keeps memory reference.

Please suggest,

Thanks
0 Kudos
2 Replies
DuncanHornby
MVP Notable Contributor
How are you creating the file gdb and data set? Are you using the geo-processor and calling geo-processor tools or using ArcObjects? If you are using the geo-processor I wonder if this is locking it? May be use IGPUtilities.ReleaseInternals?
0 Kudos
LalitArora
New Contributor III
Thanks for reply.

I'm using ArcObjects, I've created GDB using gdbWorkspaceFactory.Create(<>).

Creating few feature classes with my selection criteria.

Building geometric network using INetworkLoader2.LoadNetwork()

<Do some analysis>

Deleting geometric network like below

IFeatureDataset pDataSet=_gdbFeatureWorkspace.OpenFeatureDataset(_objConfig.DataSetName);
IEnumDataset pEnumDataset=  pDataSet.Subsets;
IDataset pdataset=pEnumDataset.Next();
while (pdataset != null)
{
      if (pdataset is IGeometricNetwork)
      {
            pdataset.Delete();
            break;                      
      }
      pdataset = pEnumDataset.Next();
}

If I delete the FGDB just after this like below

eFile = new DirectoryInfo(GDBExportFileName);

if (eFile.Exists)
{
    //required to release all used memory for deleting the FGDB
    GC.Collect();
    GC.WaitForPendingFinalizers();
    eFile.Delete(true);
}

It is throwing the specified error.
0 Kudos