Closed radiohertz closed 2 years ago
It's alright for now. As long as resources are freed is program terminates unexpectedly. I can't think of a situation when packet sniffing need not run in its own thread independently. How much memory and CPU it is consuming (ball-park)?
How much memory and CPU it is consuming (ball-park)?
@dilawar That's the issue. There seems to be a memory leak but i cant find where it is :( ( in the blocking one where the thread listens and sends the packet across a channel)
On the non blocking one (no memory leaks), mem usage is around 1.2 MB and CPU < 10%
CPU > 0.01% is way too much for this task. p0f takes less than 1% of CPU. Something is off here.
Currently, our capture functions consumes the listener and spawns a new thread and starts listening for packets and sends the packets across a channel to the user of the library (see https://github.com/SubconsciousCompute/npcap-rs/blob/main/src/lib.rs#L254-L263 ).
Provide a new interface using
pcap_next
to provide a non blocking way to capture packets.@dilawar how does this sound?