diff options
Diffstat (limited to 'doc/README.wmem')
-rw-r--r-- | doc/README.wmem | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/doc/README.wmem b/doc/README.wmem index 27a2097722..3e1e95aaef 100644 --- a/doc/README.wmem +++ b/doc/README.wmem @@ -5,9 +5,9 @@ the old 'emem' framework which was removed in Wireshark 2.0. In order to make memory management easier and to reduce the probability of memory leaks, Wireshark provides its own memory management API. This API is -implemented inside epan/wmem/ and provides memory pools and functions that make +implemented inside wsutil/wmem/ and provides memory pools and functions that make it easy to manage memory even in the face of exceptions (which many dissector -functions can raise). +functions can raise). Memory scopes for dissection are defined in epan/wmem_scopes.h. Correct use of these functions will make your code faster, and greatly reduce the chances that it will leak memory in exceptional cases. @@ -19,7 +19,7 @@ https://www.wireshark.org/lists/wireshark-dev/201210/msg00178.html If you're writing a dissector, or other "userspace" code, then using wmem should be very similar to using malloc or g_malloc or whatever else you're used -to. All you need to do is include the header (epan/wmem/wmem.h) and optionally +to. All you need to do is include the header (epan/wmem_scopes.h) and optionally get a handle to a memory pool (if you want to *create* a memory pool, see the section "3. Usage for Producers" below). @@ -53,7 +53,7 @@ changed without warning. 2.2 Wireshark Global Pools -Dissectors that include the wmem header file will have three pools available +Dissectors that include the wmem_scopes.h header file will have three pools available to them automatically: pinfo->pool, wmem_file_scope() and wmem_epan_scope(); there is also a wmem_packet_scope() for cases when the `pinfo` argument is not accessible, but pinfo->pool should be preferred. @@ -66,7 +66,7 @@ current capture file is closed. NB: Using these pools outside of the appropriate scope (e.g. using the file pool when there isn't a file open) will throw an assertion. - See the comment in epan/wmem/wmem_scopes.c for details. + See the comment in epan/wmem_scopes.c for details. The epan pool is scoped to the library's lifetime - memory allocated in it is not freed until epan_cleanup() is called, which is typically but not necessarily @@ -170,7 +170,7 @@ To create a pool, include the regular wmem header and call the wmem_allocator_new() function with the appropriate type value. For example: - #include "wmem/wmem.h" + #include <wsutil/wmem/wmem.h> wmem_allocator_t *myPool; myPool = wmem_allocator_new(WMEM_ALLOCATOR_SIMPLE); @@ -186,7 +186,7 @@ document. Regardless of which allocator you used to create a pool, it can be destroyed with a call to the function wmem_destroy_allocator(). For example: - #include "wmem/wmem.h" + #include <wsutil/wmem/wmem.h> wmem_allocator_t *myPool; @@ -206,7 +206,7 @@ allowing it to be reused later. Depending on the type of allocator, doing this and recreating the pool. This method is therefore recommended, especially when the pool would otherwise be scoped to a single iteration of a loop. For example: - #include "wmem/wmem.h" + #include <wsutil/wmem/wmem.h> wmem_allocator_t *myPool; |