Kzalloc与Kmalloc差异

 先看看kernel里的定义:

/**
 * kzalloc - allocate memory. The memory is set to zero.
 * @size: how many bytes of memory are required.
 * @flags: the type of memory to allocate (see kmalloc).
 */
static inline void *kzalloc(size_t size, gfp_t flags)
{
        return kmalloc(size, flags | __GFP_ZERO);
}

 kzalloc实现了kmalloc以及memset的功能,一个函数起到了两个函数的作用

 

 

你可能感兴趣的:(Kzalloc与Kmalloc差异)