Freeing an mbuf cluster

Bruce M. Simpson bms at FreeBSD.org
Thu Oct 2 13:05:58 UTC 2008


Yony Yossef wrote:
> Hi All,
>
> I'm trying to manually build an mbuf chain with clusters in various sizes.
> I'm doing it using the MGETHDR and MEXTADD macros, it works fine.
> Now I'm looking for the simplest way to free an mbuf cluster, since I want
> to free the clusters seperately. This function will be given as a parameter
> to MEXTADD.
>
> Is there a simple command like 'free(buf)' to free an mbuf cluster?
>   

You don't specify if you are trying to add the external storage from a 
pool you manage, in which case, you're on your own.

m_free() for a cluster or mbuf should just "do the right thing". Since 
the UMA cleanup there are destructor functions which should free the 
mbuf or cluster using the right pool.

m_freem() works on chains, of course.

cheers
BMS


More information about the freebsd-questions mailing list