Wireshark mailing list archives

Re: Replacing wmem_packet_scope() with pinfo->pool?


From: Pascal Quantin <pascal () wireshark org>
Date: Mon, 12 Jul 2021 17:57:26 +0200

Hi Evan,

Le lun. 12 juil. 2021 à 17:52, Evan Huus <eapache () gmail com> a écrit :

I've been thinking recently about starting the process of getting rid
of the "global" wmem scope methods (wmem_packet_scope,
wmem_file_scope, etc) in favour of passing them around in arguments
(or in pinfo, or something). This would let us drop a bunch of
in-scope/out-of-scope tracking and assertion, as well as make the code
more amenable to future refactors like (potentially) concurrency.

At a first glance, we already have pinfo->pool which maintains the
lifetime of the packet_info object. As far as I can reason, this is
almost/effectively the same as the existing wmem_packet_scope - it
gets cleaned up later in the dissection flow, but there's still only
ever one which gets reused for each packet.


That's also my understanding.



Is this correct? If so, does it make sense to start replacing
`wmem_packet_scope()` calls with `pinfo->pool` when pinfo is already
in scope?


I had the same idea in the past, mostly because of subtle bugs where
Wireshark was using already freed packet memory because of the difference
between packet and pool scopes (that is documented in README.wmem but still
error prone). Keeping only the later would definitely simplify things (at
the cost of another massive rename like what we did when moving from
ephemeral/seasonal memory to wmem scopes).

Best regards,
Pascal.

PS: nice seeing you active again
___________________________________________________________________________
Sent via:    Wireshark-dev mailing list <wireshark-dev () wireshark org>
Archives:    https://www.wireshark.org/lists/wireshark-dev
Unsubscribe: https://www.wireshark.org/mailman/options/wireshark-dev
             mailto:wireshark-dev-request () wireshark org?subject=unsubscribe

Current thread: