Hy!
The VC++2005 debugger has written:
Heap corruption detected at 003C5698
First-chance exception at 0x7c926a36 in WeDidIt.exe: 0xC0000005: Access violation writing location 0xfeeefeee.
by this line:
delete[] Textures->Path;
allocation:
Textures->Path = new WCHAR[PL + 1];
The new function was successful.
How can I heal this?
0xFEEEFEEE is freed memory, so you're probably doing delete[] twice.
Easiest way to avoid this is always setting the pointer to 0 after delete-ing.
Easiest way to avoid this is always setting the pointer to 0 after delete-ing.
Hey!
I tried it!
The FeeeFee adress is comes after delete[], and I did anything... =NULL after delete[] and ...!= NULL then delete ... Before the delete function the adress of the array is NOT NULL or FeeeFeee. That is the problem!
I tried it!
The FeeeFee adress is comes after delete[], and I did anything... =NULL after delete[] and ...!= NULL then delete ... Before the delete function the adress of the array is NOT NULL or FeeeFeee. That is the problem!
Sure. Addresses are only null if you set them to null yourself.
Otherwise, they're just "whatever random data happened to be at that memory location"
Otherwise, they're just "whatever random data happened to be at that memory location"
Sorry this is CORRECT:
Full code: (with some pseudo)
...
Texture->Path = new WCHAR[PathLength]
...
if(Texture->Path != NULL)
{
//At his point Texture->Path is 0x003c55e8
delete[] Texture->Path; //Here comes the error message
//At his point the adress is NOT 0xfeeefeee or NULL, it's again 0x003c55e8
Texture->Path = NULL;
}
ERROR:
Heap corruption detected at 003C5650
First-chance exception at 0x7c926a36 in WeDidIt.exe: 0xC0000005: Access violation writing location 0xfeeefeee.
What can I Do now?
Full code: (with some pseudo)
...
Texture->Path = new WCHAR[PathLength]
...
if(Texture->Path != NULL)
{
//At his point Texture->Path is 0x003c55e8
delete[] Texture->Path; //Here comes the error message
//At his point the adress is NOT 0xfeeefeee or NULL, it's again 0x003c55e8
Texture->Path = NULL;
}
ERROR:
Heap corruption detected at 003C5650
First-chance exception at 0x7c926a36 in WeDidIt.exe: 0xC0000005: Access violation writing location 0xfeeefeee.
What can I Do now?
castorX,
please post the Stack trace of your sharing violation (copy the stack window)
also it will be easyer if you will take the serveal lines of assembly code from the disassembly window and show them to us + the registers values.
I am sure this is somthing very easy to catch, you are not providing the full source code so it is allways a guess to know exactly where the problem is.
Cheers,
Nuno1
please post the Stack trace of your sharing violation (copy the stack window)
also it will be easyer if you will take the serveal lines of assembly code from the disassembly window and show them to us + the registers values.
I am sure this is somthing very easy to catch, you are not providing the full source code so it is allways a guess to know exactly where the problem is.
Cheers,
Nuno1
Ok, another guess - you're overwriting the bounds of your array, and that's screwing up the CRT enough to cause the access violation. You're definitely overwriting your array, there's the message in the debug output that says so. Are you remembering to leave room for the NULL, and are you remembering that a WCHAR is 2 bytes?
As Nuno1 says, we really need to see the full code to help further.
As Nuno1 says, we really need to see the full code to help further.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement