![]() |
|
Hanging application |
Onewing
Member #6,152
August 2005
![]() |
I've mentioned it before, but it seems my programs freeze at will. I can't seem to figure out what's wrong and I'm not sure what code to post (if any). Nothing I do causes the freeze, it happens for a different reason every time across several of my allegro 4.2 games. I'm using Windows XP Professional Version 2002 Service Pack 2. Here's the event viewer application error: [quote eventvwr] Anybody have any ideas. I've got every thing ready for version 2.0 of Toggles and want to release it, but this err makes me hesitant and I've been holding it off (also because I'm trying to make an instructional video for it for youtube and it keeps freezing).
------------ |
Kibiz0r
Member #6,203
September 2005
![]() |
Can you try it on another computer? --- |
gilles fetis
Member #7,531
July 2006
|
I also have the freeze sometimes on my current project (lisa emulator). |
Onewing
Member #6,152
August 2005
![]() |
Quote: Can you try it on another computer? I've tried the different programs on my work computer to see how they'd run. They still freeze (although not nearly as often), but that's inclusive, because it was older versions of the program and might have been caused by an unrelated action. My work system has the exact same OS, just different specs (slower). As I wrote this, I decided to check the eventvwr of my work computer. It seems to keep records back to March 13th. I noticed three "Application Hang" errors. One was for Toggles, one for explorer.exe and one was for codeblocks.exe (which I recently downloaded). Same generic error. Bump ------------ |
bamccaig
Member #7,536
July 2006
![]() |
I'm sort of intermediate so my advice might not be very useful. Have you tried stepping through the program with a debugger to see where it hangs? Maybe there is an exception not handled or something hardware-related failing? How long can you play before the hang-up? I would make sure that memory is being released properly and use exception handling where necessary. And always check for failed function calls, if you're not already.
-- acc.js | al4anim - Allegro 4 Animation library | Allegro 5 VS/NuGet Guide | Allegro.cc Mockup | Allegro.cc <code> Tag | Allegro 4 Timer Example (w/ Semaphores) | Allegro 5 "Winpkg" (MSVC readme) | Bambot | Blog | C++ STL Container Flowchart | Castopulence Software | Check Return Values | Derail? | Is This A Discussion? Flow Chart | Filesystem Hierarchy Standard | Clean Code Talks - Global State and Singletons | How To Use Header Files | GNU/Linux (Debian, Fedora, Gentoo) | rot (rot13, rot47, rotN) | Streaming |
Onewing
Member #6,152
August 2005
![]() |
Quote: Have you tried stepping through the program with a debugger to see where it hangs? It could be one minute, it could be 30 minutes and it might not happen at all. I've sat around playing while running the debugger and of those few times, it didn't freeze. I suppose I could write a function that logs which function was called and put that at the beginning of each function. I don't know, it's frustrating. Also, it didn't freeze when I was using several different profilers (when I was checking out different Window's profilers). ***!!!!!!!!!!!!!!!!!! UPDATE !!!!!!!!!!!!!!!!!!!!!*** I decided to open up a console window along side my program and output debug messages to it. In the main function that calls each object's update function, I put a call before and after, letting me know if an object completed or if stalled. I did this for the drawing as well. Then, I saved and ran it. About 10 minutes into playing and the game freezes, but guess what, messages are still being relayed to the console window! The game itself is "Not Responding". I do a "pause" on the console to see what's still going (thinking everything is still going). Then, I notice I'm only seeing the drawing functions! There are no logs about anything being updated. You'd think there's something wrong with my timer logic, but would that cause windows to declare the program "Not Resonding" in the task manager? I've got some cookies with your names on them... ------------ |
bamccaig
Member #7,536
July 2006
![]() |
A program can only respond if it's listening for input. This is achieved with multi-threading usually to allow the interface to constantly respond. It slows down execution slightly, but it keeps the user in control which is desired. It sounds like your program is trapped in the drawing code... I thought that Allegro handled threading automatically? I'm not sure... Anyway, it sounds like something is infinitely recursing or looping... Or something...
-- acc.js | al4anim - Allegro 4 Animation library | Allegro 5 VS/NuGet Guide | Allegro.cc Mockup | Allegro.cc <code> Tag | Allegro 4 Timer Example (w/ Semaphores) | Allegro 5 "Winpkg" (MSVC readme) | Bambot | Blog | C++ STL Container Flowchart | Castopulence Software | Check Return Values | Derail? | Is This A Discussion? Flow Chart | Filesystem Hierarchy Standard | Clean Code Talks - Global State and Singletons | How To Use Header Files | GNU/Linux (Debian, Fedora, Gentoo) | rot (rot13, rot47, rotN) | Streaming |
Onewing
Member #6,152
August 2005
![]() |
That sounds right, but in that case, the app itself is still valid, even if trapped in the drawing area. And if it's valid, that wouldn't cause Windows to flag it as "Not Responding," would it? For reference, here's the basic timer logic of the game:
------------ |
bamccaig
Member #7,536
July 2006
![]() |
I'm kinda new to Allegro... That looks slightly over my head. The only way I know how to do it is:
-- acc.js | al4anim - Allegro 4 Animation library | Allegro 5 VS/NuGet Guide | Allegro.cc Mockup | Allegro.cc <code> Tag | Allegro 4 Timer Example (w/ Semaphores) | Allegro 5 "Winpkg" (MSVC readme) | Bambot | Blog | C++ STL Container Flowchart | Castopulence Software | Check Return Values | Derail? | Is This A Discussion? Flow Chart | Filesystem Hierarchy Standard | Clean Code Talks - Global State and Singletons | How To Use Header Files | GNU/Linux (Debian, Fedora, Gentoo) | rot (rot13, rot47, rotN) | Streaming |
Onewing
Member #6,152
August 2005
![]() |
Argh. I took piccolo's advice from my previous thread on this topic, did manage to find some major leaks, fixed them all, but the problem persists. At this point, I'm pretty sure it has nothing to do with my code. /cry It's like the hardware interrupt timer function that consistently increases my system_time variable just doesn't interrupt anymore. I added a debug message that displays what the system_time is at the end of the game loop. When the game freezes, it constantly says it is 0. Here's another thing. The console window displaying all the debug messages constantly is outputting debug messages. If the program is not frozen and I give focus to the console window, the messages stop as soon as I click it. However, if the program is frozen and I click the console window, the messages keep going until I hit the "Pause | Break" key. Very...odd. Anyway, this might be my last post on the topic, due to my recent tomfoolery, since I have a post cap on my head of 5 posts per thread (that might just be in the Off-Topic forum though). I'll still give credits if I can... [edit] ------------ |
|