0
C++ Memory Management is broken
I'm messing around with memory management in c++, but I got weird output. It doesn't say its an error or warning, it says free(): double free detected in tcache2. What does it mean? https://code.sololearn.com/coS0bmKqyRJ7/?ref=app
2 odpowiedzi
+ 3
You are doing free and delete on ptr.
free(ptr);
delete ptr;
Please remove one of them.
+ 2
Remove delete ptr; usually delete is used with new. And free with malloc and calloc.