summaryrefslogtreecommitdiff
path: root/doc/README.wmem
diff options
context:
space:
mode:
authorEvan Huus <eapache@gmail.com>2013-05-22 15:42:12 +0000
committerEvan Huus <eapache@gmail.com>2013-05-22 15:42:12 +0000
commit5426ba4e027326d7b5bea08fd1bb8cfab0847c76 (patch)
tree16147df109ecbdf895d72ea44cf10462f2e38933 /doc/README.wmem
parenta2f6822feab6985a3b097dec62de3691ae6d57d6 (diff)
downloadwireshark-5426ba4e027326d7b5bea08fd1bb8cfab0847c76.tar.gz
Minor refactor: make the framework responsible for allocating and freeing the
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
Diffstat (limited to 'doc/README.wmem')
-rw-r--r--doc/README.wmem35
1 files changed, 18 insertions, 17 deletions
diff --git a/doc/README.wmem b/doc/README.wmem
index 31ebf1bf11..9bdf4e4f7b 100644
--- a/doc/README.wmem
+++ b/doc/README.wmem
@@ -284,23 +284,24 @@ and realloc) are non-0.
- free_all()
- gc()
- - destroy()
-
-The free_all() function takes the private_data pointer and should free all the
-memory currently allocated in the pool. Note that this is not necessarilly
-exactly the same as calling free() on all the allocated blocks - free_all() is
-allowed to do additional cleanup or to make use of optimizations not available
-when freeing one block at a time.
-
-The gc() function takes the private_data pointer and should do whatever it can
-to reduce excess memory usage in the dissector by returning unused blocks to
-the OS, optimizing internal data structures, etc.
-
-The destroy() function does NOT take the private_data pointer - it instead takes
-a pointer to the allocator structure as a whole, since that structure may also
-need freeing. This function can assume that free_all() has been called
-immediately before it (though it can make no assumptions about whether or not
-gc() has ever been called).
+ - cleanup()
+
+All of these functions take only one parameter, which is the allocator's
+private_data pointer.
+
+The free_all() function should free all the memory currently allocated in the
+pool. Note that this is not necessarily exactly the same as calling free()
+on all the allocated blocks - free_all() is allowed to do additional cleanup
+or to make use of optimizations not available when freeing one block at a time.
+
+The gc() function should do whatever it can to reduce excess memory usage in
+the dissector by returning unused blocks to the OS, optimizing internal data
+structures, etc.
+
+The cleanup() function should do any final cleanup and free any and all memory.
+It is basically the equivalent of a destructor function. For simplicity, wmem
+is guaranteed to call free_all() immediately before this function. There is no
+such guarantee that gc() has (ever) been called.
4.2 Pool-Agnostic API