ANNOUNCEMENT: Live Wireshark University & Allegro Packets online APAC Wireshark Training Session
April 17th, 2024 | 14:30-16:00 SGT (UTC+8) | Online

Wireshark-bugs: [Wireshark-bugs] [Bug 3719] New: Optimize hfid primer + plug memleak

Date: Mon, 13 Jul 2009 11:37:12 -0700 (PDT)
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=3719

           Summary: Optimize hfid primer + plug memleak
           Product: Wireshark
           Version: SVN
          Platform: Other
        OS/Version: Windows XP
            Status: NEW
          Severity: Enhancement
          Priority: Low
         Component: Wireshark
        AssignedTo: wireshark-bugs@xxxxxxxxxxxxx
        ReportedBy: kovarththanan.rajaratnam@xxxxxxxxx



Kovarththanan Rajaratnam <kovarththanan.rajaratnam@xxxxxxxxx> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Attachment #3325|                            |review_for_checkin?
               Flag|                            |


Created an attachment (id=3325)
 --> (https://bugs.wireshark.org/bugzilla/attachment.cgi?id=3325)
Optimize hfid primer + plug memleak

Build Information:
Version 1.3.0

Copyright 1998-2009 Gerald Combs <gerald@xxxxxxxxxxxxx> and contributors.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Compiled with GTK+ 2.16.2, with GLib 2.20.3, with WinPcap (version unknown),
with libz 1.2.3, without POSIX capabilities, with libpcre 7.0, with SMI 0.4.8,
with c-ares 1.6.0, with Lua 5.1, without Python, with GnuTLS 2.8.1, with Gcrypt
1.4.4, with MIT Kerberos, with GeoIP, with PortAudio V19-devel (built Jul  2
2009), with AirPcap.

Running on Windows XP Service Pack 2, build 2600, with WinPcap version 4.1
beta5
(packet.dll version 4.1.0.1452), based on libpcap version 1.0.0, GnuTLS 2.8.1,
Gcrypt 1.4.4, without AirPcap.

Built using Microsoft Visual C++ 9.0 build 30729

Wireshark is Open Source Software released under the GNU General Public
License.

Check the man page and http://www.wireshark.org for more information.


hci_h4: Optimize column/field handling

This patch optimizes the HCI H4 dissector by:

1) Only writing to COL_INFO if we couldn't find any subscribers in our
dissector table
2) Remove redundant call to proto_item_append_text(). There's no reason to
duplicate the type/direction in the protocol subtree.

This gives a nice performance boost if there many unknown frames.

--
This patch optimizes proto_tree_prime_hfid() + friends and plugs a memleak in
the process. Currently proto_tree_prime_hfid() is called when we need to track
some "interesting" fields (e.g. fields that can appear in a colour filter,
display filter, etc.). The current implementation:

1) Leaks because it assumes that a hfid/field only appears once in filters.
This clearly isn't the case if the user has specified several colour filters
using the same field.
2) Uses a counting reference scheme even though we're only interested in
knowing whether a field is referenced or not. A binary reference scheme would
suffice.
3) Creates an empty pointer array for each hfid/field even though the field may
never appear in the trace file.

This patch fixes all the above by:

1) changing the reference counting scheme so we _only_ track whether a field is
directly/indirectly referenced. We no longer need to create the empty pointer
array as part of initialization.
2) creating the 'interesting_hfids' hash table only when needed
3) using the reference scheme _before_ hitting the hash table when we need to
determine whether a field/hfid is present

Loading a 71 MB sample capture file with colour filter enabled (before and
after patch):

Before: 20 sec.
After : 14 sec.


-- 
Configure bugmail: https://bugs.wireshark.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.