c++ - Game sometimes crashes when closing or process stay in memory -



c++ - Game sometimes crashes when closing or process stay in memory -

my problem sometimes, when closing game, 1 of 2 may occur:

process stays in memory , have killed manually game crashes

i'm not sure if 2 related or independent issues. both of happen rarely, have eliminate these situations.

as crash, made dump , says crash occurs in peekmessage() function. code looks this:

bool running = true; /// reset timer timer.reset(); msg msg; zeromemory(&msg, sizeof(msg)); /// message pump while(running) { int msg_count = 10; while (peekmessage(&msg, null, 0, 0, pm_remove) && msg_count-->0) { ::translatemessage(&msg); ::dispatchmessage(&msg); if (msg.message == wm_quit) { running = false; break; } } if (applicationactive) { prepareframe(); renderframe(); } else sleep(1); sleep(1); }

from see it, message handling routine handling @ 10 messages per loop iteration. possible crash result of overflowing message queue? , process staying in memory result of "not reaching" quit message because it's far in queue? if helps, here's phone call stack dump:

ntdll.dll!_kifastsystemcallret@0() ntdll.dll!_zwwaitforsingleobject@12() + 0xc bytes ntdll.dll!_rtlpwaitoncriticalsection@8() + 0xc8 bytes ntdll.dll!_rtlentercriticalsection@4() - 0x4b84 bytes ntdll.dll!_ldrlockloaderlock@12() + 0x6b bytes ntdll.dll!_ldrloaddll@16() + 0xd8 bytes kernel32.dll!_loadlibraryexw@12() + 0xf7 bytes user32.dll!___clientloadlibrary@4() + 0x60 bytes ntdll.dll!_kiusercallbackdispatcher@12() + 0x2e bytes user32.dll!_ntuserpeekmessage@20() + 0xc bytes user32.dll!__peekmessage@24() + 0x2d bytes user32.dll!_peekmessagea@20() + 0x572 bytes

schoolbus.exe!vcasualapp::run() line 229 + 0x12 bytes c++ schoolbus.exe!wwinmain(hinstance__ * formal=0x00400000, hinstance * formal=0x00400000, hinstance * formal=0x00400000, hinstance * formal=0x00400000) line 61 c++ schoolbus.exe!__tmaincrtstartup() line 578 + 0x1c bytes c kernel32.dll!@basethreadinitthunk@12() + 0x12 bytes ntdll.dll!rtluserthreadstart@8() + 0x27 bytes ntdll.dll!_rtluserthreadstart@8() + 0x1b bytes

c++ winapi

Comments

Popular posts from this blog

web services - java.lang.NoClassDefFoundError: Could not initialize class net.sf.cglib.proxy.Enhancer -

Accessing MATLAB's unicode strings from C -

javascript - mongodb won't find my schema method in nested container -