From: mos on 14 May 2010 03:35 Hi! The code will cause msvcr100d.dll deadlock at GetProcAddress(hlib, "MessageBoxW"))) int main() { char* p = new char; delete p; delete p; return 0; } I have post the problem on microsoft.public.vsnet.ide,then I realise it is more suitable here, I am sorry if you see it twice. Best Regards. Mos.
From: Ulrich Eckhardt on 14 May 2010 04:32 mos wrote: > The code will cause msvcr100d.dll deadlock at GetProcAddress(hlib, > "MessageBoxW"))) > > int main() > { > char* p = new char; > delete p; > delete p; So what? This code is invalid, you must not call delete twice. Use auto_ptr or string/vector from the standard libraries if you have problems with memory management. Uli -- C++ FAQ: http://parashift.com/c++-faq-lite Sator Laser GmbH Geschäftsführer: Thorsten Föcking, Amtsgericht Hamburg HR B62 932
From: mos on 14 May 2010 05:26 I know the code is invalid. I just want it run or make a crash but not deadlock! "Ulrich Eckhardt" <eckhardt(a)satorlaser.com> д����Ϣ����:2devb7-1jn.ln1(a)satorlaser.homedns.org... > mos wrote: >> The code will cause msvcr100d.dll deadlock at GetProcAddress(hlib, >> "MessageBoxW"))) >> >> int main() >> { >> char* p = new char; >> delete p; >> delete p; > > So what? This code is invalid, you must not call delete twice. Use > auto_ptr > or string/vector from the standard libraries if you have problems with > memory management. > > Uli > > -- > C++ FAQ: http://parashift.com/c++-faq-lite > > Sator Laser GmbH > Gesch?ftsf��hrer: Thorsten F?cking, Amtsgericht Hamburg HR B62 932
From: RFOG on 14 May 2010 05:38 I think better way to have a crash is: char *p=0; *p='h'; On Fri, 14 May 2010 17:26:24 +0800, "mos" <mmosquito(a)163.com> wrote: >I know the code is invalid. >I just want it run or make a crash but not deadlock! > >"Ulrich Eckhardt" <eckhardt(a)satorlaser.com> дÈëÏûÏ¢ÐÂÎÅ:2devb7-1jn.ln1(a)satorlaser.homedns.org... >> mos wrote: >>> The code will cause msvcr100d.dll deadlock at GetProcAddress(hlib, >>> "MessageBoxW"))) >>> >>> int main() >>> { >>> char* p = new char; >>> delete p; >>> delete p; >> >> So what? This code is invalid, you must not call delete twice. Use >> auto_ptr >> or string/vector from the standard libraries if you have problems with >> memory management. >> >> Uli >> >> -- >> C++ FAQ: http://parashift.com/c++-faq-lite >> >> Sator Laser GmbH >> Gesch?ftsf¨¹hrer: Thorsten F?cking, Amtsgericht Hamburg HR B62 932 > ÿþM
From: mos on 14 May 2010 05:48 ok��It seems I should discrble the reason. I try the windows SEH like: #include <Windows.h> int on_exception(PEXCEPTION_POINTERS pExceptPtrs) { print("catched the exception"); return EXCEPTION_EXECUTE_HANDLER; } int main() { __try { char* p = new char; delete p; delete p; } __except(on_exception(GetExceptionInformation())) { } } But the pragram is deadlock. if I use "char* p = 0; *p = 0" the pragmram will print catched the exception That's all.
|
Next
|
Last
Pages: 1 2 3 Prev: VC++ 2010 build problems Next: Setting value to static text control at runtime |