谁来解救我!Microsoft C++ exception: long at memory location使用的是Carlos Antollini的ADO2类。SQL语句
谁来解救我!Microsoft C++ exception: long at memory location
使用的是Carlos Antollini的ADO2类。
SQL语句肯定是正确的。
inline HRESULT Recordset15::Open ( const _variant_t & Source, const _variant_t & ActiveConnection, enum CursorTypeEnum CursorType, enum LockTypeEnum LockType, long Options ) {
HRESULT _hr = raw_Open(Source, ActiveConnection, CursorType, LockType, Options);
if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this));
return _hr;
}
在HRESULT _hr = raw_Open(Source, ActiveConnection, CursorType, LockType, Options);
运行是正确的,返回为 S_OK,但是会抛出异常,在DEBUG窗口中显示:
First-chance exception at 0x7576812f in UpLoadService.exe: Microsoft C++ exception: long at memory location 0x0043eb58..
虽然不影响使用,但是我不知道这个服务程序长期使用会不会不稳定!
[解决办法]不影响使用说明有代码处理了这个异常,如果出现得不是很频繁就不用管它。
此外,谁知道“long”有动词的词性吗?
[解决办法]检查是否资源泄漏的办法之一:
在任务管理器 进程 查看 选择列 里面选择:内存使用、虚拟内存大小、句柄数、线程数、USER对象、GDI对象
让你的程序(进程)不退出,循环执行主流程很多遍,越多越好,比如1000000次甚至无限循环,记录以上各数值,再隔至少一小时,越长越好,比如一个月,再记录以上各数值。如果以上两组数值的差较大或随时间流逝不断增加,则铁定有对应资源的资源泄漏!
[解决办法]别去理它了,First chance exception不是什么问题,返回 S_OK就行了。
http://blogs.msdn.com/b/davidklinems/archive/2005/07/12/438061.aspx
[解决办法]First chance exception messages most often do not mean there is a problem in the code. For applications / components which handle exceptions gracefully, first chance exception messages let the developer know that an exceptional situation was encountered and was handled.
For code without exception handling, the debugger will receive a second chance exception notification and will stop with a unhandled exception.