aboutsummaryrefslogtreecommitdiffstats
path: root/epan/wmem/wmem_allocator.h
AgeCommit message (Collapse)AuthorFilesLines
2016-05-13Have wmem conform to checkAPIs.plMichael Mann1-3/+3
Yes, the rename of structure members is a bit hacky. Yes, catering to Windows since "GLib's v*printf routines are surprisingly slow on Windows". But it does pass checkAPIs.pl Change-Id: I5b1552472c83aa2e159f17b5b7eb70b37d03eff9 Reviewed-on: https://code.wireshark.org/review/15404 Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-02-08WMEM (allocator): fix warning: redeclaration of already-defined enum ↵Alexis La Goutte1-1/+0
'_wmem_allocator_type_t' is a GNU extension [-Wgnu-redeclared-enum] Change-Id: Ied0428324c14f248bf6857fd288b4fb5d4591230 Reviewed-on: https://code.wireshark.org/review/7033 Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com> Reviewed-by: Michael Mann <mmann78@netscape.net>
2014-03-04Remove all $Id$ from top of fileAlexis La Goutte1-2/+0
(Using sed : sed -i '/^ \* \$Id\$/,+1 d') Fix manually some typo (in export_object_dicom.c and crc16-plain.c) Change-Id: I4c1ae68d1c4afeace8cb195b53c715cf9e1227a8 Reviewed-on: https://code.wireshark.org/review/497 Reviewed-by: Anders Broman <a.broman58@gmail.com>
2013-06-19Rework wmem scoping limits so that users can still get a handle to a pool whenEvan Huus1-0/+1
it is out of scope, they just can't *allocate* in the pool. This is necessary because file-scope trees (migrating from emem) are set up on program initialization when there is no file in scope - they need to initialize with the handle, they just won't use it until a file is actually in scope. svn path=/trunk/; revision=50046
2013-05-22Minor refactor: make the framework responsible for allocating and freeing theEvan Huus1-1/+1
actual wmem_allocator_t structure. This simplifies the internal API and deduplicates a few alloc/free calls in the individual allocator implementations. I'd originally made the allocators responsible for this on purpose with the idea that they'd be able to optimize something clever based on the type of allocator, but that's clearly more work and complexity than it's worth given the small number of allocators we create/destroy. svn path=/trunk/; revision=49512
2013-05-08Round two of wmem cleanup callbacks. While the emem tree behaviour will requireEvan Huus1-1/+2
recurring callbacks, I suspect most other potential uses will be once-only, so make that possible, and improve the documentation on the remaining issues. Also separate out the code into its own files and the testing into its own test case. svn path=/trunk/; revision=49209
2013-05-07Add user callbacks to wmem. This feature is a generic way to transparently mimicEvan Huus1-4/+8
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. svn path=/trunk/; revision=49205
2013-02-08Expose the new wmem API functions, and use a consistent order ofEvan Huus1-1/+1
alloc/free/realloc across all of wmem. svn path=/trunk/; revision=47548
2013-01-19Add three more slots to the wmem allocater definition (not yet implementedEvan Huus1-3/+12
by any particular allocator) and better document the entire structure. svn path=/trunk/; revision=47163
2012-12-27Pre-declare just the enum, and not the typedef to avoid redefinition warnings.Evan Huus1-3/+3
svn path=/trunk/; revision=46818
2012-12-27Store the type of each wmem allocator.Evan Huus1-1/+4
svn path=/trunk/; revision=46814
2012-11-08Use const in wmem where possible.Evan Huus1-1/+1
svn path=/trunk/; revision=45976
2012-10-27Make the allocator destructor part of wmem_allocator_t. This avoids twoEvan Huus1-0/+1
potential bugs: - calling the wrong destroy function on an allocator - a pool allocator forgetting to call free_all on itself in the destructor Also, fix potential typedef redefinition warning in wmem_allocator_glib.h svn path=/trunk/; revision=45804
2012-10-24We're no longer defining the structure in a typedef definition, so weGuy Harris1-1/+1
don't want the typedef name after the structure definition. svn path=/trunk/; revision=45752
2012-10-24Have wmem_core.h define the wmem_allocator_t typedef, with an incompleteGuy Harris1-1/+1
structure definition of struct _wmem_allocator_t; have wmem_allocator.h give the complete structure definition. That avoids complaints about the typedef being redefined. svn path=/trunk/; revision=45750
2012-10-24Basic skeleton for wmem.Evan Huus1-0/+59
https://www.wireshark.org/lists/wireshark-dev/201210/msg00178.html svn path=/trunk/; revision=45746