-
-
Notifications
You must be signed in to change notification settings - Fork 311
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Memory leak while reading packets from pcap file? #32
Comments
This code has the same problem : PcapHandle h = Pcaps.openOffline(pcapFilename);
h.loop(0, new PacketListener() {
long nbPackets=0;
@Override
public void gotPacket(Packet p) {
UdpPacket up = p.get(UdpPacket.class);
if (up != null) {
System.out.println(nbPackets++ + " " + p.toString());
}
}
}); |
PcapHandle doesn't hold any packets. Anyway it seems someone (packet classes, jna, or stuff) leaks memory. I will investigate it. |
I tried your code with my pcap file including 600000 UDP packets but I couldn't reproduce the OOM. |
I can't, the pcap file contain some sensitive information. I finally used the Perl lib Net::Pcap to extract the data from the file without problem. If I have a non-private data to share, I will. |
What version of JRE you use? I use :
on Ubuntu 14.04 LTS |
I tried it with |
Hi Kaitoy, It looks like the problem occurs only when I run within Eclipse (It crashes my workspace most of the time when the number of packets are high). I use Eclipse 4.4 (Luna) with a lot of plugins installed. Can you try to run in Eclipse with a significant amount of packets? When I inspect with jvisualvm I see a lot of LazyValue and char[] that does not seem to be freed over time. However, I did the same test on the command line (without Eclipse) and there was no memory problem. I'm not sure what is the exact root cause of the OOM, but I think that you can close the issue. Thanks for your time. |
I ran it on Eclipse Kepler but no error. And when I monitored memory usage and objects with jvisualvm while reading a huge pcap file, it looked all objects including LazyValue and char[] are properly GCed. |
happend to me as well on MAC. |
why was this closed? I still get this with pcap4j , lots of LazyValue objects not being freed. happens with both loop function and iterate with readPacketEx. If you want example files, see this for example. From https://iextrading.com/trading/market-data/#tops |
Hi,
I'm using pcap4j for reading large pcap files.
I just dump the rawdata to Standard stdout.
At around 400 000 - 450 000 packets the program start to get slow.
Then later on I get an OOM (heap space).
Is there any option to discard the packets as I read them ? I have the impression that the packets might be accumulated in PcapHandle ?
Here's the code (tested with 1.3.1-SNAPSHOT and 1.3.0):
The text was updated successfully, but these errors were encountered: