memory alloc/free issue

bycn82 bycn82 at gmail.com
Tue Dec 9 17:33:44 PST 2014


*thanks for replying, *

*I noticed that it was because module A released the memory which allocated
in module B. thought they are using the same m_type in kmalloc/kfree.*

*below are the message,*

*Dec  9 19:05:21 dfly kernel: ipfw2 module basic unloaded malloc_uninit: 96
bytes of 'IPFW2_BASIC' still allocated on cpu 4  ---------this line is
printed when ipfw_basic modules was unloaded,  96 bytes still on the system*
*Dec  9 19:05:21 dfly kernel: IP firewall unloaded malloc_uninit: -96 bytes
of 'IPFW2_BASIC' still allocated on cpu 4  ----and this line is printed
when ipfw modules was unloaded, now it is -96 bytes*

*I am going to move the code from ipfw module to ipfw_basic module, so the
96 bytes are going to allocate/free within the same module.*

*Regards,*
*Bycn82*



On Wed, Dec 10, 2014 at 4:45 AM, Matthew Dillon <dillon at apollo.backplane.com
> wrote:

>     Memory must be allocated and freed from the same pool.  It is not
>     legal to allocate memory from one pool and free it to another.
>
>     These memory pools are struct malloc_type and typically denoted with
>     M_SOMENAME in device and network drivers.
>
>                                                 -Matt
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.dragonflybsd.org/pipermail/kernel/attachments/20141210/c541eafa/attachment-0009.html>


More information about the Kernel mailing list