Re: memory alloc/free issue
bycn82 <[email protected]> Wed, 10 Dec 2014 09:33:44 +0800
| Newsgroups | gmane.os.dragonfly-bsd.kernel |
|---|---|
| Message-ID | <CAC+JH2xp_jG65DaG-vfeDL4P+OLGkK7phNAtV68i6=WweVNm_g@mail.gmail.com> |
*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 <[email protected] > 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 >