malloc中允许的最大内存大小 [英] the maximum memory size allowed in malloc

查看:334
本文介绍了malloc中允许的最大内存大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道malloc()可以处理的最大内存大小是多少。对此有任何限制吗?我应该在哪里获得

这类信息?谢谢大家。

I am wondering what is the maximum size of memory that malloc() could
handle. Is there any limitation on that? Where am I supposed to get
this kind of information? Thank you everybody.

推荐答案

你好,

这取决于程序正在运行的平台喜欢

windows,linux或mac。我认为内存量不受任何限制,但物理内存不受限制。虽然虚拟内存扩展了物理内存,但是malloc分配了连续的内存(意思是支持
)。所以,这取决于平台处理请求的方式。

这样说,我提到我只是认为这就是答案。我希望一些优秀的程序员能回答你的问题。

Hello,
It depends on the platform that the program is working on like
windows, linux or mac. I THINK that the amount of memory is not limited
by anything, but physical memory. Although physical memory is extended
by Virtual memory, malloc allocates contiguous memory (meaning side by
side). So, it depends on the way platform handles the request.
Saying this, I mention that I just think that is the answer. I
hope some great programmers answer your question.

在comp.lang.ci中的


阅读:
我想知道malloc()可以处理的最大内存大小是多少。对此有任何限制吗?我应该在哪里获得这种信息?谢谢大家。
I am wondering what is the maximum size of memory that malloc() could
handle. Is there any limitation on that? Where am I supposed to get
this kind of information? Thank you everybody.




malloc'的参数是size_t,该类型的范围是[0,SIZE_MAX],

所以您可以*请求*的最大值是SIZE_MAX,其值从

实现到实现,并在< limits.h>中定义。对于SIZE_MAX字节的

请求是否成功取决于该组

范围之外的因素。


-

a签名



malloc''s argument is a size_t and the range of that type is [0,SIZE_MAX],
so the maximum you can *request* is SIZE_MAX, which value varies from
implementation to implementation and is defined in <limits.h>. whether a
request for SIZE_MAX bytes will succeed depends on factors outside of the
scope of this group.

--
a signature


" Jerry" < ZH ******** @ gmail.com>在消息中写道

news:11 ********************** @ c13g2000cwb.googlegr oups.com ...
"Jerry" <zh********@gmail.com> wrote in message
news:11**********************@c13g2000cwb.googlegr oups.com...
我想知道malloc()可以处理的最大内存大小是多少。


最大数字(以字节为单位)由

标准类型''size_t''表示(由< stdlib.h>
$声明b $ b和其他标题)。这个值可以并且确实在实现中有所不同。请注意,这个

值并不一定与主机

平台的可用内存一样大。

是否有任何限制那?


见上文。

我应该在哪里获得
这类信息?
I am wondering what is the maximum size of memory that malloc() could
handle.
The largest number (in bytes) representable by
standard type ''size_t'' (declared by <stdlib.h>
and other headers). This value can and does
vary among implementations. Note that this
value isn''t necessarily as large as the host
platform''s available memory.
Is there any limitation on that?
See above.
Where am I supposed to get
this kind of information?




C教科书怎么样?或ISO C标准?


-Mike



How about a C textbook? Or the ISO C standard?

-Mike


这篇关于malloc中允许的最大内存大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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