pls tell me the different issue associated with malloc and kmalloc ? and what is different betn them?
pls tell me the different issue associated with malloc and kmalloc ? and what is different betn them?
EmbLogic Research & Competency Development Labs
Phone: +91 9818467776, 8527567776, 9650467776
Email: info@emblogic.com
Copyright © EmbLogic Embedded Technologies Pvt. Ltd.
malloc is used in application layer and its header file is malloc.h
Kmalloc is used in kernel space and its header is slab.h (versions depandable ) or code_linux.h
Another Difference is —
kmalloc returns physically contiguous memory, malloc does
not guarantee anything about the physical memory mapping.
The other main difference is that kmalloc’ed memory is
reserved and locked, it cannot be swapped. malloc does not
actually allocate physical memory. Physical memory gets
mapped later, during use.
malloc funtion resides inside the stdlib.h and when we use it we have whole os facilities like swaping,virtual memory and etc so it uses the logical mapping to allocate the memory but on the other hand at kmalloc we have only kernel space and we attack on memory direct like statically…….so it allocate physical memory by kernel.
Malloc
Function: Malloc is used for applying for the memory space dynamically, it is not a key word, but a function of an application memory
Usage:
Malloc return one the intersection of memory and indicator of address, will recycle empty indicator null back to, the ones that should pay attention to are herein, when the memory is no longer used, spend free ‘ Release that the function goes on to the memory.
Kmalloc and malloc difference..malloc allocates memory from HEAP. whereas kmalloc can allocate from normal/dma/high mem.