15,471
社区成员
发帖
与我相关
我的任务
分享
CString str;
HINSTANCE hInst;
hInst=LoadLibrary(_T("te.dll"));
typedef CString (_stdcall *mGg)(CString W, CString R, int i,int iW);
mGg G=(mGg)GetProcAddress(hInst,"G");
if(!G)
{
AfxMessageBox(_T("sru-获取函数地址失败!"));
return;
}
str = G(strU,strR,iT,iW);
。。。。。。。。
FreeLibrary(hInst);
Detected memory leaks!
Dumping objects ->
{14134} normal block at 0x05E223D8, 43 bytes long.
Data: <http://baidu.lec> 68 74 74 70 3A 2F 2F 62 61 69 64 75 2E 6C 65 63
f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\inet.cpp(878) : {1097} normal block at 0x02F6E920, 4096 bytes long.
Data: <<!DOCTYPE html P> 3C 21 44 4F 43 54 59 50 45 20 68 74 6D 6C 20 50
{1096} normal block at 0x02F6CD98, 24 bytes long.
Data: < p > 1C 00 70 01 03 00 00 00 03 00 00 00 01 00 00 00
{1095} normal block at 0x02F6CD20, 58 bytes long.
Data: < p > 1C 00 70 01 14 00 00 00 14 00 00 00 01 00 00 00
{1094} normal block at 0x02F6E4F0, 48 bytes long.
Data: < p > 1C 00 70 01 0F 00 00 00 0F 00 00 00 01 00 00 00
{1093} normal block at 0x02F6CCA8, 58 bytes long.
Data: < p > 1C 00 70 01 14 00 00 00 14 00 00 00 01 00 00 00
f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\inet.cpp(610) : {1092} client block at 0x02F6E688, subtype c0, 76 bytes long.
a CHttpFile object at $02F6E688, 76 bytes long
f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\plex.cpp(29) : {1089} normal block at 0x02F6CBF0, 124 bytes long.
Data: < > 00 00 00 00 0C CC F6 02 04 00 CC 00 0C D2 1F 00
f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\map_pp.cpp(69) : {1088} normal block at 0x02F6E608, 68 bytes long.
Data: < > 00 CC F6 02 00 00 00 00 00 00 00 00 00 00 00 00
Object dump complete.
这个就是正常执行了函数后的泄漏信息。查阅资料无果。
CString str;
HINSTANCE hInst;
hInst=LoadLibrary(_T("te.dll"));
typedef CString (_stdcall *mGg)(CString W, CString R, int i,int iW);
mGg G=(mGg)GetProcAddress(hInst,"G");
if(!G)
{
AfxMessageBox(_T("sru-获取函数地址失败!"));
return;
}
str = G(strU,strR,iT,iW);
。。。。。。。。
我的这个DLL是专门获取网页的,哎,估计可能是获取网页那里处理的不好,在不释放的情况下,快速执行几次程序就非了
inline bool IsTracingEnabled(DWORD_PTR dwCategory, UINT nLevel)
{
return CTrace::IsTracingEnabled(dwCategory, nLevel);
}
inline void __cdecl CTrace::TraceV(const char *pszFileName, int nLine,
DWORD_PTR dwCategory, UINT nLevel, LPCSTR pszFmt, va_list args) const
{
AtlTraceVA(m_dwModule, pszFileName, nLine, dwCategory, nLevel, pszFmt, args);
}
inline void __cdecl CTrace::TraceV(const char *pszFileName, int nLine,
DWORD_PTR dwCategory, UINT nLevel, LPCWSTR pszFmt, va_list args) const
{
AtlTraceVU(m_dwModule, pszFileName, nLine, dwCategory, nLevel, pszFmt, args);
}
extern CTraceCategory atlTraceGeneral;
产生了错误,找了半天了
还有啊,如果用LoadLibrary 加载后的DLL如果不释放,不占用内存吗?
因为我的这个DLL同时要被调用10多次,而且每一次传递的参数都不一样,如果我不释放掉它,会不会出问题呢?