The memory leak of ArcGIS ?

113
1
07-20-2010 03:55 AM
New Contributor
This is my code,  VC 6.0++,   the leak detector is Rational Purify,

if (!InitializeApp())
{
  AoExit(0);
}

IWorkspaceFactoryPtr ipWorkspaceFactory;
ipWorkspaceFactory.CreateInstance(CLSID_FileGDBWorkspaceFactory);
if (ipWorkspaceFactory == NULL)
  return;

IWorkspacePtr ipWorkspace;
HRESULT hr;
hr = ipWorkspaceFactory->OpenFromFile((CComBSTR)"E:\\TestData\\testdata\\Latest.gdb", 0, &ipWorkspace);


The result is:
    MPK: Potential memory leak of 32 bytes from 2 blocks allocated in String::String(WORD const*,DWORD) [AFCORE.DLL]

MPK: Potential memory leak of 32 bytes from 2 blocks allocated in String::String(WORD const*,DWORD) [AFCORE.DLL]
    Offset 0x00000008 referenced by 0x0a06f4a4, a location in a section in a loaded module
Distribution of potentially leaked blocks
            32 bytes from 2 blocks of 16 bytes (first block: 0x09a22360)
Allocation location
            new(UINT)     
            String::String(WORD const*,DWORD)


MLK: Memory leak of 1 byte from 1 block allocated in wsetlocale [MSVCR71.DLL]
Distribution of leaked blocks
                 1 byte from 1 block of 1 byte (0x099a5e08)
Allocation location
            malloc        
            wsetlocale    
Reply
0 Kudos
1 Reply
New Contributor
Hey all,

I tried your codes to open a File GDB Workspace which already exists with the name testGDB.gdb:
there is also a sample in EDN, I have ArcGIS 10, Visualstudio 2008.
I always get NULL result for the variable "outWorkspace", that is why I cant get any pointer to create a feature class inside the GDB.
Is there something I am missing !? any hint !????
I have checked several times, there is no problem with my path ! because the testGDB.gdb is created directly by ArcGIS
connString is in my case : C:\Daten\Bearbeitung\testGDB.gdb which goes with the codes.

http://resources.esri.com/help/9.3/arcgisdesktop/com/samples/Geodatabase/Accessing_Data/07EA5491-885...

HRESULT openFGDBWorkspace(BSTR connString, IWorkspace** outWorkspace)
{
      IWorkspaceFactoryPtr ipWorkspaceFactory(CLSID_FileGDBWorkspaceFactory);
      return ipWorkspaceFactory->OpenFromFile(connString, NULL, outWorkspace);
}
Reply
0 Kudos