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.
On systems that use virtual memory it is more likely to relate to the size
of available virtual memory. There are lots of possible limitations e.g.
The maximum value of size_t, although there have been arguments as to
whether calloc() could exceed that.
The amount of address space the implementation can make available. That
involves issues of overall address spac available (limited by things like
pointer size) and what's the largest contiguous region of memory currently
available (issues of frangmentation, system configuration limits etc.)
Although physical memory is extended
by Virtual memory,
Wrong way of thinking of it. A virtual memory system doesn't have to have
"extra" storage e.g. swap files to be useful. On a virtual memory system a
program exists completely in a virtual address space, in no sense is
vitual memory just tacking memory on the end of "physical" memory.
malloc allocates contiguous memory (meaning side by
side).
From the point of view of the program. On a virtual memory system that
would be in the virtual address space.
So, it depends on the way platform handles the request.
That's true of pretty much anything.
C itself doesn't have anything to say about virtual memory. All it cares
about is whether a program executes correctly and produces the correct
output. If an implementation that uses virtual memory can achieve that
(and they can) then there's no problem.
Lawrence