Page 1 of 1

physical,virtual,malloc

Posted: Mon Oct 16, 2006 8:34 pm
by xyjamepa
Hi
memory management system consist of three layers
physical,virtual and malloc/new,free/delete,
so... i never used malloc in my normal program,
i used to use new and delete but i don't know exactly
what malloc does.I read some articals
about its job and they said it puts a pointer at some continuous free pages and this pages may not be continuous in the physical memory but they are in the virtual one.
Is this the way the three layers work together?
thats it some explain about malloc,free and the three layers.
Thanx

Re:physical,virtual,malloc

Posted: Mon Oct 16, 2006 9:15 pm
by Brynet-Inc

Re:physical,virtual,malloc

Posted: Tue Oct 17, 2006 4:35 am
by ces_mohab
for application development malloc() and free() differs from new and delete in the following:
1- malloc() and free() are library procedures while new and delete are operators.
2- malloc() and free() allocates and de-allocates memory of arbitrary size.
3- new and delete performs more than just allocation and deallocation. They call constructors of objects.
the following articles just describe the three layers.
http://www.osdever.net/tutorials/memory1.php?the_id=44
http://www.osdever.net/tutorials/memory2.php?the_id=45
or if you want pdf versions:
http://www.osdever.net/tutorials/pdf/memory1.pdf
http://www.osdever.net/tutorials/pdf/memory2.pdf
the main idea is having a system call more_memory() which increases the address space of a given process by amount of memory and having some management of this new area.
heap management.
There are many algorithms in the last level:
I used address-ordered first fit algorithm.
this pdf contains some description:
http://www.cs.northwestern.edu/~pdinda/ics-s05/doc/dsa.pdf
::) :)

Posted: Thu Oct 19, 2006 5:08 pm
by xyjamepa
Thanx guys that was soooooo helpfull. :D