更新时间:2022-06-27 00:09:09
否.内存的内容对free()
的工作方式没有影响.
No. the contents of the memory has no impact on how free()
works.
free()
不知道您将其用作以null终止的char字符串.永远不会在一块内存上使用strlen()
.
free()
doesn't know you were using this as a null terminated char string. It would never use strlen()
on a chunk of memory.
尝试使用valgrind之类的工具来检查代码是否泄漏.
Try a tool like valgrind to check your code for leaks.