Showing posts with label malloc. Show all posts
Showing posts with label malloc. Show all posts

Thursday, October 9, 2014

What is the difference between malloc and kmalloc?

1. Kmalloc returns physically contiguous memory whereas malloc returns only virtual contiguous memory.

2. Memory allocated by Kmalloc can't be swapped as it is reserved and locked.

malloc is used in user space.
kmalloc is used in kernel space, vmalloc can also be used here.

kmalloc and vmalloc are allowed in kernel space whereas malloc is allowed in user space.