[SNMP4J] Memery Leak in asynchronous SNMP operation

Frank Fock fock at agentpp.com
Wed Oct 26 09:15:49 CEST 2005


Hi,

This is not a memory leak, but intended behavior.
You have to call cancel in the listener method in
all cases.

I know that this is probably not intuitive, but it is
needed for handling responses to multi-cast SNMPv1/v2c
and SNMPv3 engine ID discovery requests.

Best regards,
Frank

yielruse wrote:

>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.
>  
>
>------------------------------------------------------------------------
>
>_______________________________________________
>SNMP4J mailing list
>SNMP4J at agentpp.org
>http://lists.agentpp.org/mailman/listinfo/snmp4j
>  
>


-- 
AGENT++
http://www.agentpp.com
http://www.mibexplorer.com
http://www.mibdesigner.com





More information about the SNMP4J mailing list