Debug assertion Failed DBGHEAP.C line:1044 problem resolution
Source: Internet
Author: User
In MFC programming, a member variable is defined in an. h file, especially when a hit array or struct is defined, often due to insufficient stack space to cause errors. Therefore, it is important to dynamically open up memory. This is the use of the most headache of the pointer problem. New space, it must be deleted, otherwise it will cause memory leaks, but if the pointer is not operating properly, in the delete, often pop debug assertion failed dbgheap.c line:1044 error, people are very headache. Do you love and be afraid of pointers? Now don't be afraid, there is a solution.
We can analyze the reason and remedy the problem. This is generally the cause of two points: one, array out of bounds, two, wild pointer. According to the actual situation, my question should be that the array is out of bounds.
Problem Cause: Error action, Dlg.m_ptmpdata = &m_TmpData; An error occurred while the delete pointer m_ptempdata.
Workaround: memcpy ((char *) dlg.m_ptmpdata, (char *) &m_tmpdata, sizeof (STRUCT));
Memory operation not to be lazy.
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.