-
July 24th, 2003, 08:08 AM
#1
Memory Corruption on Heap
Hi,
I have some serious problem with memory corruption on the heap, using the new and delete [] operators with TCHAR * and MultiByteToWideChar() function.
I´ve been working on an application for WinCE with VC++ Embeded and all the strings have to be converted to UNICODE. Up to here that´s OK. The problem starts when I use a code like this :
Code:
...
int iBufferLen;
TCHAR * Buffer;
Buffer = new TCHAR[ iBufferLen ] ;
...
WideCharToMultiByte(...);
...
delete [] Buffer; // <- HERE HEAPENS THE BUG!
And the BUG is :
"When the program line execute the delete [] Buffer; another part of memory is erased and this causes memory corruption."
Does anyone have any idea of what is going on ?
Thanks in advanced.
Best Regards.
Marcelo Franco
Brazil.
Franco
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|