My C ++ application crashes only in release mode and Windows 7

I am very upset about the failure of my application in Release mode in Windows 7.

In the main function, I deleted everything:

int main(int argc, char **argv, char **envp) {
    return (0);
}

But I have many directives, variables, and functions defined outside of the main functions.

It only crashes in Release mode in Windows 7. Debug mode in Windows 7 is fine; The debug and release mode in Windows XP is good.

Since I cannot debug, I do not.

Error:

Unhandled exception at 0x00dc21ca in MyApp.exe: 0xC0000005: Access violation reading location 0x8496a9bb.

Assembly line:

00DC21CA  mov         eax,dword ptr [edx+0Ch] 

This is so crazy. Please help.

Peter

PS: If I deleted everything that I defined outside the main one, then everything is in order.

PS:

char* AllocArgsMemory()
{
    return (char*)malloc(2); // works: return NULL
                             // So it seems the malloc has some problems
}
+3
source share
3 answers

, . , , , (, ). , .

, , . 0xcccccccc, .

+1

, (.pdb), . : (WinDbg, Visual Studio ..), , , , , , -. , , ; , .

, .

0

It looks like these may be some of the built-in settings / properties. I have nothing to offer (partly due to lack of information), but if it works in DEBUG mode in Windows 7, like setting all the build settings / properties in RELEASE the same way as DEBUG. If it works, you know that this is a problem with configuring the assembly

-1
source

Source: https://habr.com/ru/post/1772773/


All Articles