Strange error on "delete[] array" operation

Posted 08 February 2013 - 03:09 PM

What's up all? I'm getting a strange error during the delete[] A process. I know it is happening at that point because it is the only thing following an output before the return 0; statement. I'm seeing the output, but getting this error:

Mind you, this is happening during the delete[] A operation. It has to be since the statement immediately preceding it is executing and the statement immediately following it is return 0; to end the program.

Re: Strange error on "delete[] array" operation

Posted 09 February 2013 - 07:35 AM

Thanks for your reply. I've done what you asked and I seem to be getting the same addresses at both locations. However, the program still seems to hang right after printing the address the second time. Also, this seems to be happening only at inputs of size 64000. The larger inputs don't have a problem (inputs of 256000, 1024000, 8192000). For some reason, I'm no longer getting the crash & error message. It's just been hanging at the last address printout.

Re: Strange error on "delete[] array" operation

Well at this point, if you were running on a Linux system, I would recommend running your program through valgrind to try to see if there is some kind of memory corruption happening.

I don't think there is any free equivalent of valgrind for Windows. If you are using the Microsoft compiler and headers, I think that you can use a macro and a header file to tell the compiler and linker to enable debugging the memory allocator and be more paranoid about memory overwrites, but I don't recall what that macro and header file are right now. Something like MEM_CRT?

Re: Strange error on "delete[] array" operation

Posted 09 February 2013 - 08:19 AM

I'm using MinGW compiler. I'm really not all that experienced with using macros, either. So you think it could be some kind of memory corruption? What would be a possible fix for that sort of thing? I'm not even very sure what could cause that.