在 VS 2012 中调用 CoCreateInstance 期间符号加载缓慢

Slow loading of symbols during call to CoCreateInstance in VS 2012

在我的 MFC 项目中,我有时会调用 CoCreateInstance

if ( SUCCEEDED( CoCreateInstance ( CLSID_DragDropHelper, NULL,
                                   CLSCTX_INPROC_SERVER,
                                   IID_IDropTargetHelper,
                                  (void**) &m_piDropHelper ) ))
{
   ...
}

稍后,一旦我完成了 DragDropHelper,我就会调用 Release:

m_piDropHelper->Release();

目前一切顺利,一切正常。

但是在调试过程中,第一次调用此 CoCreateInstance 非常慢,因为 VS 正在加载大量符号(此加载在 VS 输出 window 中可见,见下文)。对同一 CoCreateInstance 的后续调用很快。但是当我重新启动 de debugee 时,第一次调用这个 CoCreateInstance 又变慢了。

我不需要这些符号。

有没有办法阻止 Visual Studio 加载所有这些符号。

调试期间输出 Window 的部分内容

'MyProg.exe': Loaded 'C:\Windows\SysWOW64\WindowsCodecs.dll', Symbols loaded (source information stripped).
'MyProg.exe': Loaded 'C:\Windows\SysWOW64\apphelp.dll', Symbols loaded (source information stripped).
'MyProg.exe': Loaded 'C:\Program Files (x86)\Common Files\TortoiseOverlays\TortoiseOverlays.dll', Cannot find or open the PDB file.
'MyProg.exe': Loaded 'C:\Program Files\TortoiseGit\bin\TortoiseGitStub32.dll', Cannot find or open the PDB file.
'MyProg.exe': Loaded 'C:\Program Files\TortoiseGit\bin\TortoiseGit32.dll', Cannot find or open the PDB file.
'MyProg.exe': Loaded 'C:\Program Files\TortoiseGit\bin\libgit232_tgit.dll', Cannot find or open the PDB file.
'MyProg.exe': Loaded 'C:\Program Files\TortoiseGit\bin\zlib132_tgit.dll', Cannot find or open the PDB file.
'MyProg.exe': Loaded 'C:\Windows\SysWOW64\msvcr120.dll', Symbols loaded.
'MyProg.exe': Loaded 'C:\Windows\SysWOW64\ws2_32.dll', Symbols loaded (source information stripped).
   <30 more similar lines>
'MyProg.exe': Unloaded 'C:\Program Files (x86)\Microsoft Office\Office14\GROOVEEX.DLL'
'MyProg.exe': Loaded 'C:\Program Files (x86)\Microsoft Office\Office14\GROOVEEX.DLL', Cannot find or open the PDB file.
'MyProg.exe': Loaded 'C:\Windows\winsxs\x86_microsoft.vc90.crt_1fc8b3b9a1e18e3b_9.0.30729.6161_none_50934f2ebcb7eb57\msvcr90.dll', Symbols loaded (source information stripped).
'MyProg.exe': Loaded 'C:\Windows\winsxs\x86_microsoft.vc90.crt_1fc8b3b9a1e18e3b_9.0.30729.6161_none_50934f2ebcb7eb57\msvcp90.dll', Symbols loaded (source information stripped).
'MyProg.exe': Loaded 'C:\Windows\winsxs\x86_microsoft.vc90.atl_1fc8b3b9a1e18e3b_9.0.30729.6161_none_51cd0a7abbe4e19b\ATL90.dll', Symbols loaded (source information stripped).
'MyProg.exe': Loaded 'C:\Program Files (x86)\Common Files\microsoft shared\OFFICE14\Cultures\OFFICE.ODF', Cannot find or open the PDB file.
'MyProg.exe': Loaded 'C:\Program Files (x86)\Microsoft Office\Office1436\GrooveIntlResource.dll', Cannot find or open the PDB file.
'MyProg.exe': Loaded 'C:\Windows\SysWOW64\RpcRtRemote.dll', Symbols loaded (source information stripped).

您可以使用 Tools/Options/Debugging/Symbols.include/exclude 个符号。

"Automatically load symbols for:" 的两个选项应该可以满足您的需求。