Jump to content
  • Advertisement
Sign in to follow this  
Ro1

OpenGL Program fails to run in 'Release' mode Error in "msize.c"

This topic is 3457 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi all, Am making a game in C++ with OpenGL (and OpenAL for sound & DevIL for image handling) for a Uni. assignment. Everything had been fine so far, until I just tried to run my game in 'Release' mode as opposed to the usual 'Debug'. And *bham!*...the program crashed with an error before I even get to the main menu. The error I receive is : "Unhandled exception at 0x03956bc8 in lesson1.exe: 0xC0000005: Access violation writing location 0x00000120." If I choose to 'Continue', I keep getting the same error message. By choosing 'Break', the program points me to the following line in a file called "msize.c" :
#endif  /* _WIN64 */
        {
 -->          retval = (size_t)HeapSize(_crtheap, 0, pblock);
        }


Here's part of the disassembly it points to :
    #endif  /* CRTDLL */
            else    /* __active_heap == __SYSTEM_HEAP */
    #endif  /* _WIN64 */
            {
                retval = (size_t)HeapSize(_crtheap, 0, pblock);
    00413759  push        ebx  
    0041375A  push        edi  
    0041375B  push        dword ptr [__crtheap (45748Ch)] 
    00413761  call        dword ptr [__imp__HeapSize@12 (42C1A4h)] 
--> 00413767  mov         esi,eax 
            }

            return retval;
    00413769  mov         eax,esi 

    }
    0041376B  call        __SEH_epilog4 (411745h) 
    00413770  ret              
                }


I don't understand what's going on at all, and since this is for a Uni. assignment, my lecturer has specified that the game should run as expected under both 'Debug' and 'Release' mode. ANY advice/solutions are gladly welcome, because I'm rather desparate now after having spent hours debugging and searching on the internet. Thanks a mil in advance!

Share this post


Link to post
Share on other sites
Advertisement
Smells like heap corruption, but it is hard to say with so little information. This is usually caused by running outside the bounds of an array, or using uninitialised variables. The latter is an immediate suspect, because AFAIK the debugger will initialise variables in a predictable fashion, possibly hiding this bug in Debug mode.

Share this post


Link to post
Share on other sites
Always, _always_, _ALWAYS_ Initialize your variables... all of them, locals, class members. Unless you're absolutely sure you don't need to (Which will be rare)

Also, turn on your warning levels to something higher than the default (I take it you're using Visual Studio.) That's your first line of defense.

Share this post


Link to post
Share on other sites
[SOLVED!]

Thanks guys, for taking the time to look and for your suggestions!

I've managed to fix up the problem after hours of poking around, debugging, etc. etc. It was to do with the way my AL sources were set up in my Audio class.

Release build now compiles and runs correctly :)

Cheers!

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!