why the memory allocated with new cant be freed using free()

Answers were Sorted based on User's Feedback



why the memory allocated with new cant be freed using free()..

Answer / durgalakshmi

new keyword does two things.
1) allocate memory using new operator
2) invokes the constructor.

so the allocated memory using new should be freed only by
delete which frees the memory by calling the destructor.

But free will not do these things.

Is This Answer Correct ?    3 Yes 0 No

why the memory allocated with new cant be freed using free()..

Answer / bharti

Because with new operator in C++ delete operator is used to
deallocate the memory. And with malloc() free() is used. S
it may not be supported by some of the compilers to free
memory with free() created by new.

Is This Answer Correct ?    1 Yes 1 No

Post New Answer

More OOPS Interview Questions

Can we create object of interface?

0 Answers  


swapping program does not use third variable

5 Answers   TCS,


I have One image (means a group photo ) how to split the faces only from the image?............ please send the answer nagadurgaraju@gmail.com thanks in advace...

0 Answers  


what is the definition of incapsulation

2 Answers  


what is the need of abstraction? what is abstraction?what is the abstraction for stack?

8 Answers   CTS, Verizon,






What is static modifier?

0 Answers  


What does I oop mean?

0 Answers  


Who invented oop?

0 Answers  


What is the diamond problem in inheritance?

0 Answers  


what is SPL in c++.

1 Answers  


What is abstraction?

9 Answers  


what is the use of classes in c++;

2 Answers   HCL,


Categories