malloc()实现 [英] malloc() implementation

查看:58
本文介绍了malloc()实现的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,


我们必须在Linux下自己实现malloc()。

任何人都可以给我一个提示从哪里开始?


我们的实现应该只能在Linux下运行。


谢谢


Karsten

Hello together,

We have to make our own implementation of malloc() under Linux. Does
anybody can give me a hint where to start?

Our implementation should only work under Linux.

Thanks

Karsten

推荐答案



Karsten Jung写道:

Karsten Jung wrote:
你好在一起,

我们必须在Linux下自己实现malloc()。是否有人可以给我一个提示从哪里开始?


libc? < www.gnu.org/software/libc/>

我们的实现只能在Linux下运行。
Hello together,

We have to make our own implementation of malloc() under Linux. Does
anybody can give me a hint where to start?
libc? <www.gnu.org/software/libc/>
Our implementation should only work under Linux.






Karsten Jung写道:
Karsten Jung wrote:
你好在一起,

我们必须在Linux下自己实现malloc()。是否有人可以给我一个提示从哪里开始?

我们的实现应该只能在Linux下工作。
Hello together,

We have to make our own implementation of malloc() under Linux. Does
anybody can give me a hint where to start?

Our implementation should only work under Linux.




阅读glibc代码(如果污染来自LGPL代码不是问题)和

问一个Linux组,记住你必须自己编写

免费和realloc代码,你必须处理是否

其他库例程正在调用你的malloc或标准的问题。

我个人不打扰没有*非常*很好的理由(可能存在
)。


您不能在标准C中编写malloc例程,这可能是
$的一部分b $ b为什么它在标准库中,因此建议在一个

Linux组中询问。

-

Flash Gordon,生活在有趣的时代。

网站 - http:/ /home.flash-gordon.me.uk/

comp.lang.c postin g指南和介绍:
http://clc-wiki.net/wiki / Intro_to_clc


Flash Gordon< sp ** @ flash-gordon.me.uk>写道:
Flash Gordon <sp**@flash-gordon.me.uk> writes:
你不能在标准C中编写一个malloc例程,这可能是它在标准库中的一部分,因此建议在
Linux组。
You can''t write a malloc routine in standard C which might be part of
why it is in the standard library, hence the suggestion of asking in a
Linux group.




你*可以*做的是静态分配一个内存缓冲区,然后

分配出来用你自己的malloc。


-


John Devereux



What you *can* do though is statically allocate a memory buffer, then
allocate out of that with your own "malloc".

--

John Devereux


这篇关于malloc()实现的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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