I\'m utilizing a library written by a collegue and discovered that valgrind
was spewing out errors related to the delete
.
The problem was t
The standard says nothing about how the memory will get deleted -- it merely says that to not match the correct new with the correct delete is undefined behavior.
Actually, new[]
followed by delete
usually frees all the memory that was allocated with new[]
, but destructors for the items in that array are not called correctly. (Most of the time -- not that the standard mandates that)
Rather than dynamically allocated arrays, you should consider use of vector
.