|
|
maximum possible allocation
hello
is there a maximum size that can be allocated by a malloc call?
is this defined by the standard?
thanks
Sami Evangelista
|
|
0
|
|
|
|
Reply
|
evangeli (63)
|
7/16/2004 3:22:22 PM |
|
Evangelista Sami <evangeli@cnam.fr> wrote:
> hello
> is there a maximum size that can be allocated by a malloc call?
Yes. But that depends on your system, i.e. how much memory you have
and lots of details of your OS (some systems even let you allocate
much more memory than you have real memory, RAM and swap taken to-
gether, but will kill your process if you ever try to use it all).
> is this defined by the standard?
No, only restriction is that the size can be stored in a number of
type size_t because of how malloc() is declared.
Regards, Jens
--
\ Jens Thoms Toerring ___ Jens.Toerring@physik.fu-berlin.de
\__________________________ http://www.toerring.de
|
|
0
|
|
|
|
Reply
|
Jens.Toerring (807)
|
7/16/2004 4:10:49 PM
|
|
"Evangelista Sami" <evangeli@cnam.fr> wrote in message
news:5f59677c.0407160722.40b0b512@posting.google.com...
> hello
>
> is there a maximum size that can be allocated by a malloc call?
Theoretically, as many bytes whose total number
can be expressed with type 'size_t'. But the
range of 'size_t' is implementation defined.
It must be an unsigned integer type, with a
minimum magnitude of 65535. The maximum single
allocation size possible is also limited by the
host operating system.
> is this defined by the standard?
See above.
-Mike
|
|
0
|
|
|
|
Reply
|
mkwahler (3821)
|
7/16/2004 4:30:34 PM
|
|
In 'comp.lang.c', evangeli@cnam.fr (Evangelista Sami) wrote:
> is there a maximum size that can be allocated by a malloc call?
Can't be greater than the value of ((size_t)-1) of your implementation. That
said, non linear objects (arrays of pointers, lists, trees) can be much
bigger [1].
> is this defined by the standard?
No. Sky's the limit. The standard only defines minima for the biggest
objetcts (allocated or static).
0x7FFF in C90
0xFFFFU in C99
----------
[1] I wonder what a calloc() is capable of... ((size_t)-1) x ((size_t)-1),
sounds incredible! I guess that even its size might not fit into the biggest
unsigned integer object.
--
-ed- get my email here: http://marreduspam.com/ad672570
The C-language FAQ: http://www.eskimo.com/~scs/C-faq/top.html
C-reference: http://www.dinkumware.com/manuals/reader.aspx?lib=c99
FAQ de f.c.l.c : http://www.isty-info.uvsq.fr/~rumeau/fclc/
|
|
0
|
|
|
|
Reply
|
emdelYOURBRA (457)
|
7/16/2004 5:29:12 PM
|
|
In <Xns9528C63ABCC23hsnoservernet@212.27.42.73> Emmanuel Delahaye <emdelYOURBRA@noos.fr> writes:
>No. Sky's the limit. The standard only defines minima for the biggest
>objetcts (allocated or static).
>
>0x7FFF in C90
>0xFFFFU in C99
^
Is this U supposed to make any difference? What and why?
>----------
>[1] I wonder what a calloc() is capable of... ((size_t)-1) x ((size_t)-1),
>sounds incredible! I guess that even its size might not fit into the biggest
>unsigned integer object.
If you use calloc to ask for an object whose size exceeds SIZE_MAX you're
in undefined behaviour territory.
Dan
--
Dan Pop
DESY Zeuthen, RZ group
Email: Dan.Pop@ifh.de
|
|
0
|
|
|
|
Reply
|
Dan.Pop (3615)
|
7/19/2004 3:49:45 PM
|
|
In <5f59677c.0407160722.40b0b512@posting.google.com> evangeli@cnam.fr (Evangelista Sami) writes:
>is there a maximum size that can be allocated by a malloc call?
>is this defined by the standard?
The standard guarantees that at least one object of 32767 bytes can be
allocated, but it doesn't guarantee that it can be *dynamically*
allocated, or even that each and every program can allocate such an
object (think of an implementation with a 16-bit address space where
the text segment already exceeds 32 kB).
An implementation where *all* malloc (and friends) calls fail all the
time is still perfectly conforming. Even malloc(0) is allowed to return
a null pointer, so the answer to your question is not even zero ;-)
OTOH, if you're asking about what is the maximum value that can be
requested from a malloc call (with no guarantees of success), the
answer is (size_t)-1 (or SIZE_MAX in C99).
As a side note, C99 attempts to exclude platforms with a 16-bit
address space from having hosted implementations, as the one
allocatable object size is increased to 65535. For no redeeming
benefits, AFAICS.
Dan
--
Dan Pop
DESY Zeuthen, RZ group
Email: Dan.Pop@ifh.de
|
|
0
|
|
|
|
Reply
|
Dan.Pop (3615)
|
7/19/2004 4:01:57 PM
|
|
|
5 Replies
46 Views
(page loaded in 0.103 seconds)
Similiar Articles: the maximum memory size allowed in malloc - comp.lang.cThere are lots of possible limitations e.g. The maximum value of size_t, although there have been ... correct that much more memory can be available to multiple allocations ... FFT Return Values - comp.dsp... 0 to 1.0 where 0.0 represents no sounds and 1.0 represents the maximum possible ... extreme values gumbel distribution - comp.soft-sys.matlab ... I need to know this ... extreme values gumbel distribution - comp.soft-sys.matlab ...I would like to adjust this data to a Gumbel distribution ... Is it possible to do it in Matlab? Somebody knows how ... got your estimates, but I'm guessing not by maximum ... mount xfs with 64kb blocksize - comp.os.linux.miscI`d like to know there is any possible way to mount xfs ... for the Linux kernel, by rewriting the memory allocation ... you what page size you have > and what is the maximum ... MLPPP vs. Cisco CEF - comp.dcom.sys.cisco... with a Cisco 36xx series router what is the maximum ... source IP, the destination IP, or a couple of possible ... If, though, you've arranged the distribution so that the ... normal likelihood function &covariance matrix ¶meter ...... Density Estimation data > To ... is then possible to ... Copula Estimation - One Step Maximum Likelihood - comp ... estimation for the multivariate normal distribution ... GARCH(1,1) MLE Question - comp.soft-sys.matlabIf possible add the derivatives as well. Thank you very ... sys.sas... sys.sas... arise when you do maximum ... random number generator from t location scale distribution ... Allocatable versus automatic arrays - comp.lang.fortranIs that some maximum value, or is it just a value that ... Allocation and deallocation do take time, but if much ... real detriment in this is that it is at least possible ... Jumbo frames on T1000 1Gb interfaces? - comp.unix.solaris ...And if so, what is the maximum size of the jumbo ... that at the time of writing it > was *not* possible to ... At least not in the standard Solaris 10 distribution. How to check whether malloc has allocated memory properly in case ...i want to check after calling malloc whether allocation is ... If possible I would design the program so that `size' is ... the maximum memory size allowed in malloc - comp.lang.c ... maximum possible allocation - C / C++maximum possible allocation. C / C++ Forums on Bytes. ... hello is there a maximum size that can be allocated by a malloc call? is this defined by the standard? File Allocation Table - Wikipedia, the free encyclopediaA parallel development in MS-DOS / PC DOS which allowed an increase in the maximum possible FAT size was the introduction of multiple FAT partitions on a hard disk. 7/16/2012 8:37:36 PM
|
|
|
|
|
|
|
|
|