Wireshark-dev: Re: [Wireshark-dev] [Wireshark-commits] rev 44559: /trunk/epan/dissectors/ /trun
Date: Mon, 20 Aug 2012 12:41:30 -0400 (EDT)
I guess this makes #3 from http://www.wireshark.org/lists/wireshark-dev/201208/msg00164.html an unfortunate "yes".  I guess I had the same idea you did - slowly replacing all g_ alloced memory in dissectors with se_ alloced memory where possible, and replace the rest of the g_ alloced memory with a new API (so g_ alloced APIs could be deprecated within dissectors).  I've seen pe_ suggested, but I don't like it because its too easy to transpose to ep_ (and vice versa).  I would suggest we_ for "Wireshark scoped".  If #3 was "no" (because the possible extra memory was better than the possibility of hidden leaks), I could be more indiscriminate about the changes.   Is there a dissector with a good fragmentation algorithm that doesn't use g_ alloced memory?  Or were you refering to the "problem being solved" as being global (for all dissectors), or just SCTP?
 
In grepping g_ functions that allocate memory, the only real justified cases (IMO) seem to be:
1. UAT data
2. "Dissector registration data" from dissectors registering with each other
3. Dynamic hf (or similar) arrays
 
I'd like to see the rest go by the wayside, and that was my motivation for posting http://www.wireshark.org/lists/wireshark-dev/201208/msg00164.html in the first place.
-----Original Message-----
From: Jeff Morriss <jeff.morriss.ws@xxxxxxxxx>
To: wireshark-dev <wireshark-dev@xxxxxxxxxxxxx>
Sent: Mon, Aug 20, 2012 11:28 am
Subject: Re: [Wireshark-dev] [Wireshark-commits] rev 44559: /trunk/epan/dissectors/ /trunk/epan/dissectors/: packet-sctp.c

mmann@xxxxxxxxxxxxx wrote:
> http://anonsvn.wireshark.org/viewvc/viewvc.cgi?view=rev&revision=44559
> 
> User: mmann
> Date: 2012/08/17 07:55 PM
> 
> Log:
>  Use capture scoped memory for hash table functionality
> 
> Directory: /trunk/epan/dissectors/
>   Changes    Path             Action
>   +6 -58     packet-sctp.c    Modified

I had looked at doing something similar before but I discovered a good 
reason not to: now (with this change) the SCTP dissector will keep *2* 
copies of each fragment until the file is closed: once for each 
individual fragment and another one once the reassembly is done.  IOW in 
this case there seemed to be a good reason for using g_malloc()'d 
memory: so we can free the (temporary) copies of the fragments once the 
reassembly is done (which should be well before the capture file is closed).

(That's not to say this method is the best; ideally we wouldn't have to 
do all this allocating + copying + freeing but I've never been inspired 
to try to solve that problem.)
___________________________________________________________________________
Sent via:    Wireshark-dev mailing list <wireshark-dev@xxxxxxxxxxxxx>
Archives:    http://www.wireshark.org/lists/wireshark-dev
Unsubscribe: https://wireshark.org/mailman/options/wireshark-dev
             mailto:wireshark-dev-request@xxxxxxxxxxxxx?subject=unsubscribe