* This function should be called only once when Wireshark or TShark starts
* up.
*/
-void
+static void
ep_init_chunk(void)
{
ep_packet_mem.free_list=NULL;
#endif
emem_init_chunk(&ep_packet_mem);
+}
+
+/* Initialize the capture-lifetime memory allocation pool.
+ * This function should be called only once when Wireshark or TShark starts
+ * up.
+ */
+static void
+se_init_chunk(void)
+{
+ se_packet_mem.free_list = NULL;
+ se_packet_mem.used_list = NULL;
+ ep_packet_mem.trees = NULL;
+
+ se_packet_mem.debug_use_chunks = (getenv("WIRESHARK_DEBUG_SE_NO_CHUNKS") == NULL);
+ se_packet_mem.debug_use_canary = se_packet_mem.debug_use_chunks && (getenv("WIRESHARK_DEBUG_SE_USE_CANARY") != NULL);
+
+ emem_init_chunk(&se_packet_mem);
+}
+
+/* Initialize all the allocators here.
+ * This function should be called only once when Wireshark or TShark starts
+ * up.
+ */
+void
+emem_init(void)
+{
+ ep_init_chunk();
+ se_init_chunk();
+
+ if (getenv("WIRESHARK_DEBUG_SCRUB_MEMORY"))
+ debug_use_memory_scrubber = TRUE;
#if defined (_WIN32)
/* Set up our guard page info for Win32 */
#endif /* _WIN32 / USE_GUARD_PAGES */
}
-/* Initialize the capture-lifetime memory allocation pool.
- * This function should be called only once when Wireshark or TShark starts
- * up.
- */
-void
-se_init_chunk(void)
-{
- se_packet_mem.free_list = NULL;
- se_packet_mem.used_list = NULL;
- ep_packet_mem.trees = NULL;
-
- se_packet_mem.debug_use_chunks = (getenv("WIRESHARK_DEBUG_SE_NO_CHUNKS") == NULL);
- se_packet_mem.debug_use_canary = se_packet_mem.debug_use_chunks && (getenv("WIRESHARK_DEBUG_SE_USE_CANARY") != NULL);
-
- emem_init_chunk(&se_packet_mem);
-
- /* This isn't specific to se_ memory, but need to init it somewhere.. */
- if (getenv("WIRESHARK_DEBUG_SCRUB_MEMORY"))
- debug_use_memory_scrubber = TRUE;
-}
-
#ifdef SHOW_EMEM_STATS
#define NUM_ALLOC_DIST 10
static guint allocations[NUM_ALLOC_DIST] = { 0 };
#include "gnuc_format_check.h"
+/* Initialize all the memory allocation pools described below.
+ * This function must be called once when *shark initialize to set up the
+ * required structures.
+ */
+void emem_init(void);
+
/* Functions for handling memory allocation and garbage collection with
* a packet lifetime scope.
* These functions are used to allocate memory that will only remain persistent
* Everytime a new packet is dissected, all memory allocations done in
* the previous packet is freed.
*/
-/* Initialize packet-lifetime memory allocation pool. This function is called
- * once when [t]Wireshark is initialized to set up the required structures.
- */
-void ep_init_chunk(void);
/* Allocate memory with a packet lifetime scope */
void *ep_alloc(size_t size);
*
* These functions are very fast and offer automatic garbage collection.
*/
-/* Initialize capture-lifetime memory allocation pool. This function is called
- * once when [t]Wireshark is initialized to set up the required structures.
- */
-void se_init_chunk(void);
/* Allocate memory with a capture lifetime scope */
void *se_alloc(size_t size);