Welcome! Log In Create A New Profile

Advanced

Freeing memory using kfree

Posted by ravi.chakram 
Freeing memory using kfree
January 10, 2014 02:57AM
I have basic query, please help me to understand.

I have created 30 bytes of memory using kmalloc and freed the allocated memory using kfree. My diubht is, how kfree will come to know that it has to free 30bytes for this pointer?

char *c = (char *)kmalloc(30*sizeof(char));
kfree(c); //How kfree will come to it has to free 30 bytes.
Re: Freeing memory using kfree
April 05, 2014 07:33PM
Hi ravi,

It seems that the code of

void kfree(const void *objp)

is located in

mm/slab.c

winking smiley
Author:

Your Email:


Subject:


Spam prevention:
Please, solve the mathematical question and enter the answer in the input field below. This is for blocking bots that try to post this form automatically.
Question: how much is 19 plus 11?
Message: