[Winpcap-users] Memory Management with pcap_next_ex()

David Chang dchang at fsautomation.com
Tue Aug 19 18:46:41 GMT 2008


I think the memory is managed automatically (you do not need to free it). 
It is guaranteed to persist until the next pcap_next_ex (or other dispatch 
function) call.

At one point I thought the capture buffer was of fixed size.  It is the 
classic producer / consumer problem.  Packets get put into the buffer as 
fast as they arrive on the interface.  Packets get removed from the buffer 
as quickly as your processing function calls pcap_next_ex().  If you do not 
remove them quickly enough from the buffer, packets will be dropped.


----- Original Message ----- 
From: "Stanislav Tsanev" <skt304 at lehigh.edu>
To: <winpcap-users at winpcap.org>
Sent: Monday, August 18, 2008 7:09 PM
Subject: [Winpcap-users] Memory Management with pcap_next_ex()

>I am using pcap_next_ex() to read packets from a capture file. Who is 
>responsible for managing the memory that the two pointers I get back from 
>the function call point to? Is that memory reused as is the case when I use 
>a callback? If that's the case, how long is it guaranteed to persist? If 
>not, how do I free it?
> I was looking for documentation on that but couldn't find anything.
> thank,
> slavy
> _______________________________________________
> Winpcap-users mailing list
> Winpcap-users at winpcap.org
> https://www.winpcap.org/mailman/listinfo/winpcap-users

More information about the Winpcap-users mailing list