Wireshark-commits: [Wireshark-commits] rev 49205: / /trunk/doc/: README.wmem /trunk/epan/wmem/: Mak

Date: Tue, 07 May 2013 19:23:11 GMT
http://anonsvn.wireshark.org/viewvc/viewvc.cgi?view=rev&revision=49205

User: eapache
Date: 2013/05/07 12:23 PM

Log:
 Add user callbacks to wmem. This feature is a generic way to transparently mimic
 the behaviour emem has for seasonal trees, which is that the master tree
 structure is not actually seasonal - it is permanent. When the seasonal memory
 pool is cleared, the root node pointer in all of these permanent trees is set
 to NULL, and the pool takes care of actually freeing the nodes.
 
 Wmem can now mimic this by allocating the tree header struct in epan_scope(),
 allocating any node structs in file_scope(), and registering a callback on
 file_scope() that NULLs the pointer in the epan_scope() header. Yes, this is
 confusing, but it seemed simpler than adding manual callback registrations to
 every single dissector that currently uses seasonal trees.
 
 The callbacks may also be useful for other things that need cleanup (I'm
 thinking resource handles stored in wmem memory that need to be fclosed or
 what-have-you before they the handle is lost).
 
 As indicated by the number of caveats in README.wmem, the implementation
 probably needs a bit of work to make it safer/saner/more-useful. Thoughts
 (or patches!) in this direction are more than welcome.

Directory: /trunk/doc/
  Changes    Path           Action
  +31 -0     README.wmem    Modified

Directory: /trunk/epan/wmem/
  Changes    Path                Action
  +2 -1      Makefile.common     Modified
  +8 -4      wmem_allocator.h    Modified
  +43 -0     wmem_core.c         Modified
  +12 -3     wmem_core.h         Modified
  +35 -0     wmem_test.c         Modified
  +57 -0     wmem_user_cb.h      Added