Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
是否存在malloc失败,而calloc返回成功的情况。假设我给出malloc(20)并且calloc(4*5),是否存在任何malloc可能失败和calloc成功的场景。如果是这样,确切的原因是什么。
malloc
calloc
malloc(20)
calloc(4*5)
我能想到malloc()失败和calloc()成功的唯一原因是某个库(或您的应用程序)是否覆盖了一个而不是另一个。
malloc()
calloc()
当然,任何libc会发生这种情况的地方都被破坏了。
libc