Hi all, I am using ucd-snmp-4.2.7.pre1 on TRU64
I am trying to receive an snmp trap and then log it via the callback. What I am seeing is substantial memory growth (1M per 500 traps). I suspect that I need to clean something up after or in the callback, could you advise based on the rough code below if I am doing something wrong? void GetTraps(void* magic, int port) { struct snmp_session session, *ss; init_snmp("Test"); init_mib(); snmp_sess_init(&session); session_p->peername = SNMP_DEFAULT_PEERNAME; session_p->local_port = port; session_p->version = SNMP_DEFAULT_VERSION; session_p->community_len = SNMP_DEFAULT_COMMUNITY_LEN; session_p->retries = SNMP_DEFAULT_RETRIES; session_p->timeout = SNMP_DEFAULT_TIMEOUT; session_p->callback = OnTrapRec; session_p->callback_magic = magic; session_p->authenticator = NULL; ss = snmp_open(&session); if (ss) { int numfds = 0; fd_set fdset; FD_ZERO(&fdset); struct timeval timeout; timerclear(&timeout); int block = 1; for (;;) { snmp_select_info(&numfds, &fdset, &timeout, &block); int count = select(numfds, &fdset, 0, 0, 0); if (count > 0) { snmp_sess_read(&fdset); } } } snmp_close(ss); snmp_shutdown("Test"); } int OnTrapRec(int op, struct snmp_session *session, int reqid, struct snmp_pdu *pdu,void *magic) { std::cout << "OnTrapRec" << std::endl; } Many thanks in advance, Tipp Concerned about your privacy? Instantly send FREE secure email, no account required http://www.hushmail.com/send?l=480 Get the best prices on SSL certificates from Hushmail https://www.hushssl.com?l=485 ------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Do you grep through log files for problems? Stop! Download the new AJAX search engine that makes searching your log files as easy as surfing the web. DOWNLOAD SPLUNK! http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642 _______________________________________________ Net-snmp-users mailing list Net-snmp-users@lists.sourceforge.net Please see the following page to unsubscribe or change other options: https://lists.sourceforge.net/lists/listinfo/net-snmp-users