free(), the size to free?
    Greg KH 
    greg at kroah.com
       
    Wed May 25 14:17:22 EDT 2016
    
    
  
On Wed, May 25, 2016 at 02:00:41PM -0400, Wenda Ni wrote:
> The prototype is void kfree(const void *).
> 
> As the input pointer is void *, how does the kernel know the size of memory to
> be freed? There should be some metadata recorded under the hood, right?
Yes there is.  See the memory allocation code for the details.
Same goes for the C language implementation of free(), look at any libc
implementation for more details about that if you are curious, the
basics are the same for within the kernel.
thanks,
greg k-h
    
    
More information about the Kernelnewbies
mailing list