This is a discussion on Re: Please help about the snmp table indexes and memory lack - SNMP ; On Fri, 2008-09-05 at 16:21 +0800, SongHao@kaifa.cn wrote: > > Hello, > > I run a snmp agent developed under Net-SNMP in an embed > system, the program eats much memory when adding indexes for each > table. > > ...
On Fri, 2008-09-05 at 16:21 +0800, SongHao@kaifa.cn wrote:
> I run a snmp agent developed under Net-SNMP in an embed
> system, the program eats much memory when adding indexes for each
> I call the following functions to initialize the table:
> set min_colnum and max_colnum...
> /*initialise the contents of table*/
> for (i=1; i<=TAB_ROW_CNT; i++)
> xxxTable_createEntry(..., i)
> I definite the row number as index for each table. And all the data
> to be get and set are external to snmp agent. In function
> I create enough rows to add the indexes(the row number exactly). So if
> the table contain much more rows, the initialize table process takes
> more time and consume much more memory.
> If I remove the index, snmpget could work because I can get the row
> and col number by parsing request packets. And then I can get data by
> using the row and col number.
> But the snmpgetnext couldn't work.
> Any other "helper" or "container" or table structure should I use?
This all depends on how the data you wish to present looks and how they
are stored in your application.
You need to be able to do find(index) and find_next(index) where index
is of the index type for your table and the items are ordered in
lexicografical order on index.
This might mean that you have to add another index to your table unless
you are free to specify that it should be in the correct order.
The tdata helper do create the secondary index for you and allocates it
Now I understand that dynamic allocations are troublesome in an embedded
environment but I can't say much more without knowledge of the
constraints you are working under.
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
Net-snmp-coders mailing list