Dereferencing deleted pointers always result in an Access Violation?

Accessing memory through a deleted pointer is undefined behavior. You can’t expect any reliable/repeatable behavior.

Most likely it “works” in the one case because the string is still “sitting there” in the now available memory -= but you cannot rely on that. VS fills memory with debug values to help force crashes to help find these errors.

Leave a Comment