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