I am working on a custom container class. My main method runs correctly. Iterating the contents and printing via cout. Once complete it then throws a runtime error.
HEAP CORRUPTION DETECTED: before Normal block (#3) at 0x00A60F40 CRT detected that the application wrote to memory before the start of the heap buffer.
My IDE its putting a breakpoint on my destructor which is currently empty. I am guessing the cause of this error could be here.
However, I am not sure how to correctly write my destructor. From my understanding, I need to destroy the T[] which has created via NEW in the constructor. Access to this array is via std::unique_ptr<T[]> m_buffer. I have tried serval methods of destroying the array to solve the error but none have worked.
It seems the object is constructed and deleted correctly.
You might start from your skeleton and add functionalities to both your class and the driver program until you come across the error.
Just compile often.
HEAP CORRUPTION DETECTED: before Normal block (#3) at 0x00A60F40 CRT detected that the application wrote to memory before the start of the heap buffer.
was being caused by how I was handling my pointers in the push_back method in my ring buffer and not connected to the destructor