An error occurred while initializing the application.

Source: Internet
Author: User

Case 1:
Case Study of the stereocamera project one day in the 1949th month
(A heap error occurs when memset is out of bounds during initialization of a Global Object)
This is a strange problem. The version of stereocamera. dll will be released after work on Friday.

Down the latest code from VSS, compile, connect, run ,!!! An error occurred while initializing the application! Faint! It also fails to be put in the PC directory.

One-step debugging. before entering the main () function, the system prompts that the application initialization failed! It seems that the cause should appear in the code before entering the main function, that is, when executing some global variable constructor, then look for it and find that the problem occurs in the trace () constructor, because the trace object is constructed in the stereocamera constructor, and stereocamera is a global static variable.

Then we located the malloc2d function. However, from the perspective of the crash scene, the memory of malloc is not very large in every aspect of the Code logic. how can we fail?
The error is similar to the following code new int [10], and new runs the bad_alloc exception.

Logically speaking, it should not be a problem with insufficient memory, because there is no problem with checking through the task manager.
Shouldn't too many new operations be performed in the initialization of global variables? (That is, you cannot execute too many malloc operations before entering main ?) Try to move the new trace code in the function to a common member function and test the code.

It seems that this problem is complicated. The code is not self-written. Ah.

Finally, the original author of the code finds out that the memory of a memset is out of bounds, which damages the system memory and causes bad_alloc.

Case 2:
Another case of one day in the 1949th month. Led_calibration Project
(The original SLN solution file is not used)
I have been in my notebook. Now, after I use a desktop, many codes need to be down from VSS.
Today, the latest led_calibration code was down, the SLN solution was deleted, a solution was created by myself, and then compiled and run. The pop-up window is: Application initialization failed! It's strange that the previous programs will fail!
In addition, vc2005 prompts that a DLL loaded by the process has a heap error, leading to loading failure!

Depressed, then changed Xiao Zhao's computer, and re-down the code on VSS,I didn't delete the SLN this time, and directly used the SLN under the VSS down (although you can't open the SLN file by double-clicking it, but you can open vc2005 first and drag the SLN file in), compile, run, OK!

It's a strange problem for me. Then, go back to your desktop, and down the sln files on VSS, compile and run them. I rely on them. That's good!

What do you mean? In addition, vc2005 showed me a correct DLL error. It's inexplicable.

 

Case 3:
Some interfaces of tsgui are rewritten, and a test console test case is written. I have been using it well, but suddenly a compilation and Running won't work. It's strange that I haven't changed anything about tsgui, even if the changes are within the normal scope.
Error prompt:
Windows has triggered a breakpoint in test.exe.
The cause may be that the heap is damaged, which also indicates that there is a bug in test.exe or any DLL it loads.

Output Window:
Access conflict occurs when 0x7c92e470 in test.exe is the most likely exception: 0xc0000005: The read location is 0x00000130.
R6034
An application has made an attempt to load the C Runtime Library without using a manifest.
This is an unsupported way to Load visual C ++ DLLs. You need to modify your application to build with a manifest.
For more information, see the "Visual C ++ libraries as shared side-by-side assemblies" topic in the product documentation.
Windows has triggered a breakpoint in test.exe.

The cause may be that the heap is damaged, which also indicates that there is a bug in test.exe or any DLL it loads.

# If defined (_ crt_check_manifest) <br/> If (! _ Check_manifest (hdllhandle) <br/>{< br/>__ try <br/>{< br/> _ nmsg_write (_ rt_checkmanifest ); <br/>}< br/> _ expect T (exception_execute_handler) <br/>{< br/> outputdebugstring (_ get_rterrmsg (_ rt_checkmanifest )); <br/> debugbreak (); <br/>}</P> <p> _ ioterm (); /* shut down lowio */<br/> _ mtterm ();/* free TLS index, call _ mtdeletelocks () */<br/> _ heap_term (); /* heap is now invalid! */<Br/> return false; <br/>}< br/> # endif/* defined (_ crt_check_manifest )*/

Check the prompt to see the failure point. It seems to be a manifest problem. Modify the project property list tool-General-use the FAT32 solution to re-compile OK.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.