On Wed, 2005-04-27 at 17:14, Emmanuel Doguet wrote: > But I want use dynamic allocating, so I allocate my data (a simple > table) in "*_get_first_data_point" and freeing in *_get_next_data_point" > when index is out of range.
Nope - that doesn't sound right. Remember that the get_{first,next}_data_point routines are used to walk through the table in order to determine the appropriate row to use. This all happens before the main handler is called to actually do the main task of answering the SNMP request. This means that the table data must remain valid throughout. Not just during the get_{first,next} walk, but afterwards too. You can't safely release this until after the handler has completed. Depending on exactly what you mean by "dynamic allocating", one approach would be to free the table at the very end of your handler routine. Alternatively, you could use the cache_handler to load the table data before starting to process the table (instead of doing this within get_first_data_point), and use this for a specified period before releasing it again. That would result in slightly stale data, but would probably prove a bit more efficient - allowing the same table data to be used for more than one SNMP request. Remember that the get_{first,next}_data_point walk is concerned with processing *ONE* SNMP request. If you're issuing a standard "snmpwalk" command, this will involved sending a series of individual GetNext requests, *each* of which will trigger a full get_{first,next} walk. Dave ------------------------------------------------------- SF.Net email is sponsored by: Tell us your software development plans! Take this survey and enter to win a one-year sub to SourceForge.net Plus IDC's 2005 look-ahead and a copy of this survey Click here to start! http://www.idcswdc.com/cgi-bin/survey?id=105hix _______________________________________________ Net-snmp-coders mailing list Net-snmp-coders@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/net-snmp-coders