是的malloc /释放由libc中提供的系统调用或库例程? [英] Is malloc/free a syscall or a library routine provided by libc?

查看:133
本文介绍了是的malloc /释放由libc中提供的系统调用或库例程?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果的malloc /自由是实现为的libc库例程,然后才是它的基础上实现了的 SBRK 的系统调用或 MMAP 的系统调用,还是其他什么东西?

If malloc/free is implemented as a library routine in libc, then is it implemented on top of the sbrk syscall or the mmap syscall, or something else?

和是一般,没有在声明的函数的 SYS / syscall.h 的包含了所有的系统在目标机器电话?

And to be general, does the function declared in sys/syscall.h contains ALL the system calls in the target machine?

推荐答案

的malloc 免费是标准C库功能,这是每一个C实现来实现。

malloc and free are standard C library functions which are to be implemented by each C implementation.

C标准只定义了这些功能的行为方式,并从他们所期望的行为。它们是如何在左侧实施到每个执行。

The C standard only defines the way in which these functions behave and the behavior expected from them. How they are to be implemented in left to each implementation.

总之他们是你使用的执行实现细节。

In short they are implementation detail of the implementation you use.

(一个执行包括编译器,链接器,运行时库,并可能是其他一些东西。)

(An "implementation" consists of the compiler, the linker, the runtime library, and probably a few other things.)

这篇关于是的malloc /释放由libc中提供的系统调用或库例程?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆