I have problems to deallocate 2 vectors in a structure. At the beginning of a function I allocate memory for these vectors. Then I work with them (without change the inicial position of the pointer). That is:
allocate
call function that works with them
deallocate
In this point I get this error: HEAP corrupted windows has triggered a break point..." and the file dbgheap.c was opened.
In the output window I have this: "Heap block at 05251688 modified at 0528D6B4 past requested size of 3c024.
I can't see the error because I checked out the pointer before and after call the function and it's right.
//do some stuff (like fourier transformation, etc)
deallocate
free(vector1);
free(vector2);
Can it be that I have problems with the projet properties? under 'code generation'->'runtime library' /MT,/MTd....what is the best option for my application (It's a multithread application). I think if I change this options I have the same error but the break point is triggered in other position in this file dbgheap.c ...(at the moment I'm working with /MT...)
You're almost certainly writing off the end of one or both of your memory blocks.
It's not working fine in Release, it's just not reporting the error. The Debug allocator returns blocks of memory with guard bytes at each end, so an overwrite can be detected.
Are you sure that size of a double times size of a pointer is all that's required?
You ask the allocator for a memory block of some size. If it can, it gives a pointer to a block that big. When you're done with it you give it back by passing back the pointer.
You already know the size as you asked for it to begin with.