In said:
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