Steps to Duplicate
Create a class that implements PacketListener
Open a capture and then send traffic to the machine that has an implemented packetArrived method. Don't add any additional code to the packetArrived method. Just let the method accept packets.
When I performed the above steps, I notice a distince memory leak while viewing my java process in the task manager. Trying to drill down into the problem, I used JProfiler to look at the Java code to see if the memory was occuring in there. With the profiler, I could not detect a leak. I therefore believe that the code is in the JNI code (somewhere in the process.cpp, or the jpcap.c code). Being a novice with JNI, I would appreciate somebody looking into the situation to see where the leak is coming from.
Logged In: NO
I am currently having the same problem as well! Thank you for letting me know I'm not the only one! How do we get around this though? I will search...
Logged In: NO
Hello! I found a workaround for this! Thank God He let me find this out - I've been looking for an answer for about a month!
In the native C code, the capture() method has the memory leak. Where exactly I'm not sure, but when I put it into a while loop to not capture an infinite amount of packets but, say, 2000, I don't get the memory leak that I used to.
while(true)
{
m_pam.capture(...); // make sure to only capture a fixed number
}
This is working for now at least. If it hasn't stopped the leak, it at least has exponentially slowed it down.
Take care!
Elijah
Logged In: YES
user_id=1262793
Originator: NO
Solution is given in #1962174.
Logged In: YES
user_id=1262793
Originator: NO
Numereous sources of memory leaks have been addressed in the forthcoming release 2.0.
Does the suggested work-around really stop the memory leak? In our application we started passing 2000 instead of -1 to capture method and we called it in a while loop. For first two days there was no memory increase -- very good. However from third day the memory again grows by 3 MB per day. I am puzzled now.
When is version 2.0 coming?
The suggested workaround is wrong. You should call capture as few times as possible, as there is a leak every time you call it. There are several other leaks. 2.0 should be out by the end of the year, in fact the coding and testing is complete; we are just addressing some build issues.