crash in memory heap allocation - windows 7 - Unicode project
-
Hi, what is difference between windows 7 and windows 2003 sever in memory heap allocation? i have a project in visual studio 2008 C++ with using Unicode for character setting. my project run in 2003 sever without any problem. but when i run it in windows 7, my project is breaked on a "memory allocation" line in code, like:
int i_size = 50;
wchar_t* wch = new wchar_t[i_size];with this error message:
this maybe due to a corruption of the heap, which indicate a bug in my.exe or any of the Dlls it has loaded.
please help me.Zo.Naderi-Iran
-
Hi, what is difference between windows 7 and windows 2003 sever in memory heap allocation? i have a project in visual studio 2008 C++ with using Unicode for character setting. my project run in 2003 sever without any problem. but when i run it in windows 7, my project is breaked on a "memory allocation" line in code, like:
int i_size = 50;
wchar_t* wch = new wchar_t[i_size];with this error message:
this maybe due to a corruption of the heap, which indicate a bug in my.exe or any of the Dlls it has loaded.
please help me.Zo.Naderi-Iran
This means that the heap has been corrupted somewhere else in your code. you will need to do some debugging to discover where it happens; usually caused by overrunning a buffer somewhere.
Unrequited desire is character building. OriginalGriff I'm sitting here giving you a standing ovation - Len Goodman
-
This means that the heap has been corrupted somewhere else in your code. you will need to do some debugging to discover where it happens; usually caused by overrunning a buffer somewhere.
Unrequited desire is character building. OriginalGriff I'm sitting here giving you a standing ovation - Len Goodman
-
but my project compile and run in windows 2003 sever without any heap corruption! what difference between windows 2003 and windows 7 ?
Zo.Naderi-Iran
Different is Windows 7 is giving you better security(probably) Here is an example of how heap crashed In one of my application I defined a string variable with the size of 20, I was reading the text from a text box. But User Put more than 20 character in that box. It never crash in xp. But Do worse it destroy another value which has been defined right after that sting variable. So, Its better it crashed cause at least you know where you can find the problem
-
Different is Windows 7 is giving you better security(probably) Here is an example of how heap crashed In one of my application I defined a string variable with the size of 20, I was reading the text from a text box. But User Put more than 20 character in that box. It never crash in xp. But Do worse it destroy another value which has been defined right after that sting variable. So, Its better it crashed cause at least you know where you can find the problem
-
but my project compile and run in windows 2003 sever without any heap corruption! what difference between windows 2003 and windows 7 ?
Zo.Naderi-Iran
Just because it runs successfully in one system does not mean it is bug free. If it crashes because of heap corruption it is almost guaranteed that there is a bug in your code somewhere.
Unrequited desire is character building. OriginalGriff I'm sitting here giving you a standing ovation - Len Goodman
-
Hi, what is difference between windows 7 and windows 2003 sever in memory heap allocation? i have a project in visual studio 2008 C++ with using Unicode for character setting. my project run in 2003 sever without any problem. but when i run it in windows 7, my project is breaked on a "memory allocation" line in code, like:
int i_size = 50;
wchar_t* wch = new wchar_t[i_size];with this error message:
this maybe due to a corruption of the heap, which indicate a bug in my.exe or any of the Dlls it has loaded.
please help me.Zo.Naderi-Iran
You have a bug in your code, so run App Verifier on it and it will tell you exactly where it is happening. --edit-- Who is the prick who one voted this? If you are developing code and not running it through app verifier you are missing out on an opportunity to boost your products quality.
============================== Nothing to say.
-
i guess that my problem is not in size of memory allocation. However, i will check it. but, is any other reason?
Zo.Naderi-Iran
zon_cpp wrote:
is any other reason?
Such as what? If the heap is corrupted that means there is a piece of code that is writing somewhere in memory at an address that it does not own - it's a bug.
Unrequited desire is character building. OriginalGriff I'm sitting here giving you a standing ovation - Len Goodman
-
Hi, what is difference between windows 7 and windows 2003 sever in memory heap allocation? i have a project in visual studio 2008 C++ with using Unicode for character setting. my project run in 2003 sever without any problem. but when i run it in windows 7, my project is breaked on a "memory allocation" line in code, like:
int i_size = 50;
wchar_t* wch = new wchar_t[i_size];with this error message:
this maybe due to a corruption of the heap, which indicate a bug in my.exe or any of the Dlls it has loaded.
please help me.Zo.Naderi-Iran
In case it's not been clear in the other messages: A heap corruption message, and specifically that message, is telling you that somewhere, somewhen, the internal stuctures of the heap's memory management have been overwritten (corrupted). Because it did not or could not detect it at the moment it happened, heap corruptions are reported when you do something that requires the heap and that's when the run time library runs a "heap consistency check" and throws the error message. So, it's not telling you that the particular call you did was wrong, it's just that the call was the first place it detected a previous corruption. So it's important to not focus on that particular call as the source of the problem. However, that call does give you a point in time when the corruption occurred. If you have other allocation / deallocation calls in your code, you know that the corruption occurred sometime between the last heap call and this one. That gives you a chance to narrow down the section of code to look at. Lastly, heap corruption detection only happens in debug mode code / libraries as it is a performance hog. So, you can have had this bug for a long time and never notice it in production mode code.
-
Hi, what is difference between windows 7 and windows 2003 sever in memory heap allocation? i have a project in visual studio 2008 C++ with using Unicode for character setting. my project run in 2003 sever without any problem. but when i run it in windows 7, my project is breaked on a "memory allocation" line in code, like:
int i_size = 50;
wchar_t* wch = new wchar_t[i_size];with this error message:
this maybe due to a corruption of the heap, which indicate a bug in my.exe or any of the Dlls it has loaded.
please help me.Zo.Naderi-Iran
If I had to guess, that line is probably not the problem, your problem is elsewhere. Just happens to break at that point, can you look at the call stack and see what calls happened prior to the error?