New is concerned with initialising memory by calling the object's constructor. There are different news' that get memory from different heaps or no heap at all (which we call placement new).
malloc allocates memory from the heap. free deallocates said memory (releases it back to the heap).
new first calls malloc (in most, if not all, standard library implementations) to allocate memory from the heap, then runs the constructor of the object. delete first calls the destructor of the object, then calls free (again, in most impls) to release the memory back to the heap.
There is one small caveat: placement new. Placement new is a special syntax in which the programmer specifies the memory address at which the object should reside, thus allowing new to bypass its first step.
Dynamic Object Initialisation consists of the various steps:
1)Allocate memory
2)returning the pointer
3)Initialising the object.
In the case of the malloc,you need to
specify the size of the memory needed to be allocated.
you need to type cast the returned pointer to the memory.
you need to call the constructor manually to initialise the object that has been dynamically allocated.
Obj=(void*)malloc(sizeofObject);
Whereas in the case of the new call,all the above things are done automatically.
you dont need to specify the size.
you dont need to type cast the pointer to the memory
you dont have to call the constructor for the object explicitly.
Obj=new Class();