[AGENT++] Resource management

Jens Rehsack rehsack at googlemail.com
Mon Oct 25 17:47:41 CEST 2010


Hi all,

during development of smart-snmpd prove of concept I encountered
several resource issues, which I'd like to discuss:

1) memory management of snmp++/smival
   I rate it as non-object oriented to derive from smival but implicite delegate
   memory management to derived classes. This would provoke duplicated
   code (e.g. in a weak moment I thought about implementing support for
   float data types as used in ucd-mibs, which would result in many duplicated
   code of OpaqueStr - because I won't want grant access to the binary
   bytes of the float)
   I started a refactoring (see attachment), but to complete it, a
full rewrite of
   src/address.cpp will be needed (what might be a good idea anyway ...)

2) fast mutexes
   agent++ is using fast POSIX mutexes (and doesn't allow to change that
   easily), but fast mutexes don't stack (same thread locks again and result
   in some kind of deadlock).
   Because of mib.cpp can only "update()" MibTable deriveds, it's ugly
   complicated to manage the updates of our own complex objects.
   Further, when mutexes don't stack, it's definitively wrong to lock
the MibEntry
   on calling get_request()/get_next_request(). Non-stacking mutexes must
   be controlled by their appropriate owners only.

3) MibTable index_info
   The documentation of index_info is very short and doesn't explain clearly
   what it's good for (and how it affects is_valid_index).
   Further: MibTable( oid, int, bool ) constructor's documentation doesn't match
   it's implementation (what might bring some light into index_info using).

Best regards,
Jens


More information about the AGENTPP mailing list