[SNMP4J] Memery Leak in asynchronous SNMP operation

yielruse yielruse at 126.com
Wed Oct 26 08:29:36 CEST 2005


Hi, 

The memery leak happens when using org.snmp4j.Snmp.send(PDU, Target, Object, ResponseListener) to do asynchronous SNMP operation. These asynchronous operations are done by a same Snmp instance.

The reason is that, in the method send(PDU, Target, TransportMapping, Object, ResponseListener), some objects has been put into asyncRequests(an Hashtable ), but in some case, they are not remove from asyncRequests.

In following case, they are removed:
1)  the asynchronous operation is cancled.

In following case, they are NOT removed:
1)  the asynchronous operation is timeout.
2)  the asynchronous operation cause an IOException
3)  the asynchronous operation is finished successfully


I have make some change to Snmp.java, to remove the objects in asyncRequests when timeout or IOException. It seemed NO memery leak happens again. It's so strange because I did NOT remove the objects in asyncRequests when the operation succeeded. Does it be removed in elsewhere?

Forgive my poor English.

Regards.


More information about the SNMP4J mailing list