From c2b2d204db58fe40cecd28ba21c72d4d1038d1c8 Mon Sep 17 00:00:00 2001 From: Evan Huus Date: Sat, 12 Oct 2013 21:01:17 +0000 Subject: Redo r52569 in a way that doesn't break the GUI. Add a mem_pool member to tree_data and reference it directly when allocating/freeing tree items. This lets us keep multiple around when we need them, and still lets us use wmem_free_all for a major speedup. It also, coincidentally, lets us get rid of the annoying fi_tmp hack that was needed before, since that element gets swept up in the free_all with everything else. Keep one pool cached to avoid creating/destroying a pool for each packet, another minor performance win. The various changes in approach seem to balance out pretty much exactly, this still gives ~11% over pre-52569. svn path=/trunk/; revision=52573 --- epan/proto.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'epan/proto.h') diff --git a/epan/proto.h b/epan/proto.h index 5083db6100..204b565278 100644 --- a/epan/proto.h +++ b/epan/proto.h @@ -46,6 +46,7 @@ #include #include +#include #include "ipv4.h" #include "wsutil/nstime.h" @@ -485,7 +486,7 @@ typedef struct { gboolean fake_protocols; gint count; struct _packet_info *pinfo; - field_info *fi_tmp; + wmem_allocator_t *mem_pool; } tree_data_t; /** Each proto_tree, proto_item is one of these. */ @@ -609,6 +610,9 @@ WS_DLL_PUBLIC void proto_tree_children_foreach(proto_tree *tree, /** Retrieve the tree_data_t from a proto_tree */ #define PTREE_DATA(proto_tree) ((proto_tree)->tree_data) +/** Retrieve the wmem_allocator_t from a proto_node */ +#define PNODE_POOL(proto_node) ((proto_node)->tree_data->mem_pool) + /** Sets up memory used by proto routines. Called at program startup */ void proto_init(void (register_all_protocols_func)(register_cb cb, gpointer client_data), void (register_all_handoffs_func)(register_cb cb, gpointer client_data), -- cgit v1.2.3