First, free corresponds to malloc; delete corresponds to new; free is used to release the dynamic memory generated by malloc, and delete is used to release the dynamic memory space generated by new.
new and delete are C++ operators, while malloc and free are functions in C.
New does two things, one is to allocate memory, but to call the constructor of the class; similarly, delete will call the destructor of the class and release the memory. Whereas malloc and free just allocate and free memory.