diff options
author | Guy Harris <guy@alum.mit.edu> | 2016-08-13 16:41:54 -0700 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2016-08-13 23:42:35 +0000 |
commit | c0f24bdf6c255068d3de386b00c1d0db3041a98f (patch) | |
tree | 9a7124bf1e4ba9ce2e08c9a6ef017fff81162187 /epan/addr_resolv.c | |
parent | 631139b1eb48fdb171c28141e15d2a18854bef15 (diff) |
Allocate all the wmem maps with epan scope.
That doesn't seem to affect the performance negatively (or
positively...) to any noticeable degree with my simple "run tshark under
the time command with an empty file" tests, and it does appear to reduce
the amount of memory that valgrind thinks is leaked.
All the other maps were already allocated with epan scope, so do that
with these as well.
Change-Id: Ib5ee85c8cf025e53455564a67cd1adbf28b47f78
Ping-Bug: 12656
Reviewed-on: https://code.wireshark.org/review/17040
Reviewed-by: Guy Harris <guy@alum.mit.edu>
Diffstat (limited to 'epan/addr_resolv.c')
-rw-r--r-- | epan/addr_resolv.c | 19 |
1 files changed, 3 insertions, 16 deletions
diff --git a/epan/addr_resolv.c b/epan/addr_resolv.c index c58fe40cfa..66e6510ccb 100644 --- a/epan/addr_resolv.c +++ b/epan/addr_resolv.c @@ -1286,9 +1286,9 @@ initialize_ethers(void) guint mask = 0; /* hash table initialization */ - wka_hashtable = wmem_map_new(NULL, eth_addr_hash, eth_addr_cmp); - manuf_hashtable = wmem_map_new(NULL, g_int_hash, g_int_equal); - eth_hashtable = wmem_map_new(NULL, eth_addr_hash, eth_addr_cmp); + wka_hashtable = wmem_map_new(wmem_epan_scope(), eth_addr_hash, eth_addr_cmp); + manuf_hashtable = wmem_map_new(wmem_epan_scope(), g_int_hash, g_int_equal); + eth_hashtable = wmem_map_new(wmem_epan_scope(), eth_addr_hash, eth_addr_cmp); /* Compute the pathname of the ethers file. */ if (g_ethers_path == NULL) { @@ -1318,18 +1318,6 @@ initialize_ethers(void) } /* initialize_ethers */ -/* this is only needed when shuting down application (if at all) */ -static void -eth_name_lookup_cleanup(void) -{ - wmem_free(NULL, manuf_hashtable); - manuf_hashtable = NULL; - wmem_free(NULL, wka_hashtable); - wka_hashtable = NULL; - wmem_free(NULL, eth_hashtable); - eth_hashtable = NULL; -} - /* Resolve ethernet address */ static hashether_t * eth_addr_resolve(hashether_t *tp) { @@ -3229,7 +3217,6 @@ addr_resolv_init(void) void addr_resolv_cleanup(void) { - eth_name_lookup_cleanup(); vlan_name_lookup_cleanup(); service_name_lookup_cleanup(); ipx_name_lookup_cleanup(); |