您的位置:首页 > 其它

频繁new长时间后操作异常,跟debug版最大new次数限制有关!

2010-12-19 18:09 309 查看
Debug信息:

TESTAPPD! CallSETranslator(struct EHExceptionRecord *,struct EHRegistrationNode *,void *,void *,struct _s_FuncInfo const *,int,struct EHRegistrationNode *) + 197 bytes

TESTAPPD! __InternalCxxFrameHandler + 962 bytes

TESTAPPD! __InternalCxxFrameHandler + 894 bytes

TESTAPPD! __InternalCxxFrameHandler + 227 bytes

TESTAPPD! __CxxFrameHandler + 44 bytes

NTDLL! 77fbb272()

NTDLL! 77facc28()

NTDLL! 77f91bc6()

BCCORE! 0c067fa0()

_heap_alloc_dbg(unsigned int 37, int 1, const char * 0x00000000, int 0) line 378 + 9 bytes

_nh_malloc_dbg(unsigned int 37, int 1, int 1, const char * 0x00000000, int 0) line 248 + 21 bytes

_nh_malloc(unsigned int 37, int 1) line 197 + 19 bytes

operator new(unsigned int 37) line 24 + 11 bytes

BCCORE! 0c067fb4()

std::allocator<char>::allocate(unsigned int 33, const void * 0x00000000) line 59 + 25 bytes

std::basic_string<char,std::char_traits<char>,std::allocator<char> >::_Copy(unsigned int 9) line 526 + 17 bytes

std::basic_string<char,std::char_traits<char>,std::allocator<char> >::_Grow(unsigned int 9, unsigned char 1) line 568

std::basic_string<char,std::char_traits<char>,std::allocator<char> >::assign(const std::basic_string<char,std::char_traits<char>,std::allocator<char> > & {0x06a95829 ""}, unsigned int 0, unsigned int 4294967295) line 128 + 16 bytes

std::basic_string<char,std::char_traits<char>,std::allocator<char> >::basic_string<char,std::char_traits<char>,std::allocator<char> >(const std::basic_string<char,std::char_traits<char>,std::allocator<char> > & {0x06a95829 ""}) line 44 + 54 bytes

_MY_STRUCT::_MY_STRUCT(const _MY_STRUCT & {...}) + 222 bytes

APP_TASK::svc() line 249 + 18 bytes

ACED! 100dded1()

ACED! 100de7a7()

ACED! 100de6a4()

ACED! 10033256()

_threadstartex(void * 0x032dff78) line 227 + 13 bytes

KERNEL32! 77e6b3bc()

CSDN有个帖子曾提到:

我的一个程序不停的转了两天 出了一个异常对话框 (unknowned software exception
0x800000003, address 0xxxxxxxxx),在那个地址加断点再跟踪,居然是在 dbgheap.c
中_heap_alloc_dbg() 的

static long _lRequestCurr = 1; /* Current request number */

_CRTIMP long _crtBreakAlloc = -1L; /* Break on allocation by request

number */

_heap_alloc_dbg()



...

lRequest = _lRequestCurr;

/* break into debugger at specific memory allocation */

if (lRequest == _crtBreakAlloc)

_CrtDbgBreak();

...



处,其实 _CrtDbgBreak() 的汇编就是一个 int 3.

但这个 int 3 吧 如果你是用 vc 转碰上了 也就是一个对话框( user breakpoint at address 0xxxxxxxxx )

如果是 F10 走的话连框都不出 但如果你不是用 vc 转而是执行你的程序 碰上 int 3 就会出异常( 要么终止要么调试那种);

而这个 _lRequestCurr 是调一次就加一的 从 1 加到 -1 也就是四十多亿次,

通过加断点来测量 我的程序一分钟就调了该函数 60 万次( 也就是调 New,我都没有显示的调 New,都是什么 CString std::string 调的 ),结果转了两天就出一个异常。

不知道大家碰到过这种情况没有。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐