开发者

Can we release 'malloced' memory using 'delete'? [duplicate]

开发者 https://www.devze.com 2023-01-27 00:06 出处:网络
This question already has answers here: Closed 12 years ago. Possible Duplicate: malloc and delete in C++, opinions
This question already has answers here: Closed 12 years ago.

Possible Duplicate:

malloc and delete in C++, opinions

Can a memory obtained using the 'malloc' function call be freed using 'delete'?

I tried a simple code using a very simple structure and it seems to be working fine. But, purify reports freeing mismatched memor开发者_开发技巧y.

If this is a problem, how big is the problem? If such mismatched freeing of memory exists in the code is it mandatory to fix it?


This might work on some platforms, but no you may not. It's not portable and it's an error.

0

精彩评论

暂无评论...
验证码 换一张
取 消