tcpdump mailing list archives

Memory leak in libpcap (top of tree) and/or kernel


From: "Gianluca Varenni" <gianluca.varenni () cacetech com>
Date: Fri, 10 Jul 2009 15:35:28 -0700

Hi all.

I just discovered an interesting leak with the libpcap 1.0 or the current top-of-tree.

On Fedora 10, kernel 2.6.27.5 or 2.6.27.12, there is a memory leak by which a simple program like this one will eventually use all the memory on the system (as reported by top) and eventually the application gets killed by the OS (and as a side effect the graphical system gets killed too and restarts). This happens only if the usbmon devices are listed (I tried on a VM disabling and enabling the virtual USB controller. No VM tools are installed on the guest, we are able to replicate it on a physical machine).

The interesting part is that in top the memory usage of the process is always < 1%, but the total amount of free memory on the system goes down to few megabytes, until the OS finally kills the process.

Here is the small test application.

int main()
{
   pcap_if_t *ifs;
   char errbuf[PCAP_ERRBUF_SIZE];

   do
   {
       if (pcap_findalldevs(&ifs, errbuf) != 0)
       {
           printf("error");
           break;
       }

       pcap_freealldevs(ifs);
   }
   while(1==1);

   return 1;
}

Has anyone experienced that?

Have a nice day
GV
-
This is the tcpdump-workers list.
Visit https://cod.sandelman.ca/ to unsubscribe.


Current thread: