[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: memory and function pointer problem



Hi,

gaurav sharma wrote:

> If this is the case then why I am not getting seg fault above as my program is 
> also accessing more virtual memory than was allocated ?

Because malloc() do what it wants, for example it may allocate more than
one page for a single allocation. I don't know how the Glibc malloc()
works, but you might want to have a look at how Slab allocators [1] work
do get a clue about what memory allocators do.

Sincerly,

Thomas

[1]
http://www.usenix.org/publications/library/proceedings/bos94/bonwick.html
-- 
Thomas Petazzoni
thomas.petazzoni@xxxxxxxx

--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/