Re: malloc

Uriel Corfa <[email protected]>
Newsgroups gmane.linux.c-programming
Message-ID <[email protected]>
On Mon, Dec 20, 2010 at 5:39 AM, ratheesh k <[email protected]> wrote:
> Is the below statement right or wrong ?
>
> malloc tries to allocate continous memmory space in virtual address
> space.  not in physical address space.

Hi,

This is true, but in theory, malloc doesn't have a notion of a virtual
or physical address space. Malloc is defined as : it tries to allocate
a contiguous memory chunk of at least the required size in a
system-defined pool. The question of setting up virtual address
spaces, of lazy allocation of physical pages, etc. is left up to the
underlying OS. In other terms : it's mmap(2) and brk(2) that take care
of this. Malloc relies on them for this kind of questions.

Regards,

-- 
Uriel Corfa
--
To unsubscribe from this list: send the line "unsubscribe linux-c-programming" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.