lwip-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

AW: [lwip-users] memory leak when sending snmp trap


From: Mathias Zenger
Subject: AW: [lwip-users] memory leak when sending snmp trap
Date: Thu, 11 Jun 2009 07:25:31 +0200

I have no experience using SNMP and I don't know if there is something wrong with the API use. However I am wondering if your parameters for the blocking delay call are correct. Perhaps you just have a timing problem. Normally I use a time constant related to portTICK_RATE_MS in my FreeRTOS tasks. E.g. if you would like your task to repeat every 10ms you probably rather use
 
#define sendtrapTICK_RATE    10 / portTICK_RATE_MS    //10ms
 
...
 
vTaskDelayUntil( &xLastWakeTime, sendtrapTICK_RATE );
 
 

-----Ursprüngliche Nachricht-----
Von: address@hidden [mailto:address@hiddenIm Auftrag von Alexandre Malo
Gesendet: Mittwoch, 10. Juni 2009 22:59
An: lwip
Betreff: [lwip-users] memory leak when sending snmp trap

Hello,
 
   I am having memory leak with a task sending trap.
 
Here is my simple task:
 
#define MY_SNMP_ENTERPRISE_ID 4464
#define MY_SNMP_SYSOBJID_LEN 7
#define MY_SNMP_SYSOBJID {1, 3, 6, 1, 4, 1, MY_SNMP_ENTERPRISE_ID}
 
void vSendTrapTask( void * pvParameters )
{
   portTickType xLastWakeTime;
   struct snmp_obj_id objid = {MY_SNMP_SYSOBJID_LEN, MY_SNMP_SYSOBJID};
   struct snmp_varbind *vb;
   static unsigned char msg[] = "
address@hidden";
   static unsigned char msglen= 22;
 
   (void) pvParameters;
  
   for ( ;; )
   {
      xLastWakeTime = xTaskGetTickCount();
     
      vb = snmp_varbind_alloc(&objid,
                           SNMP_ASN1_OPAQUE,
                           msglen);
                             
      vb->value = &msg;
           
      trap_msg.outvb.head = vb;
      trap_msg.outvb.tail = vb;
      trap_msg.outvb.count = 1;
     
      snmp_send_trap(SNMP_GENTRAP_ENTERPRISESPC, &objid, 0);
     
      trap_msg.outvb.head = NULL;
      trap_msg.outvb.tail = NULL;
      trap_msg.outvb.count = 0;
      vb->value = NULL;
     
      snmp_varbind_free(vb);
     
      // Wait for the next cycle.
      vTaskDelayUntil( &xLastWakeTime, 10 );
   }
}
 
Do I use correctly snmp_varbind_alloc?
 
I want to notify that the thread works for a random number of sent trap. I tried it more than once and its never the same amount of trap that is received.
 
Thanks!
Alexandre Malo

reply via email to

[Prev in Thread] Current Thread [Next in Thread]