Wireshark mailing list archives
Re: Freeing memory of se_alloc'ated object
From: Max <dmitrmax () gmail com>
Date: Sun, 1 May 2011 23:15:05 +0400
2011/5/1 Guy Harris <guy () alum mit edu>:
On May 1, 2011, at 4:51 AM, Max wrote:I'm writing a dissector for a TCP-based protocol. I have a conversation state object of my proto which is managed by conversation_*_proto_data(). The state object is alloced by se_alloc(), so it has a lifetime of capture, but the object itself contains libgcrypt handles which are alloced by g_malloc. How should I free these handles? Is there any mean to catch the moment when my state object is about to be destroyed?If you register a routine with register_init_routine() (the routine takes no arguments and returns no value), it will be called *after* all the se_alloc()ated memory is freed. Will that suffice?
Well, the handles to the allocated resources are stored *in* the se_alloc()ated memory. So a callback which is called just after it is freed is pretty much useless. From the other side I can store the handles in two places: 1) in the conversation's state object where I use them; 2) in some global list of allocated resources which is read and deallocated in the routine you've described. But am I the only guy who finds this ugly? In this situation it would be perfect if se_alloc() engine could call a callback with a user supplied argument before it starts to deallocate anything. -- Max ___________________________________________________________________________ Sent via: Wireshark-dev mailing list <wireshark-dev () wireshark org> Archives: http://www.wireshark.org/lists/wireshark-dev Unsubscribe: https://wireshark.org/mailman/options/wireshark-dev mailto:wireshark-dev-request () wireshark org?subject=unsubscribe
Current thread:
- Freeing memory of se_alloc'ated object Max (May 01)
- Re: Freeing memory of se_alloc'ated object Guy Harris (May 01)
- Re: Freeing memory of se_alloc'ated object Max (May 01)
- Re: Freeing memory of se_alloc'ated object Guy Harris (May 01)
- [PATCH] Re: Freeing memory of se_alloc'ated object Max (May 01)
- Re: [PATCH] Re: Freeing memory of se_alloc'ated object darkjames-ws (May 02)
- Re: [PATCH] Re: Freeing memory of se_alloc'ated object Max (May 02)
- Re: [PATCH] Re: Freeing memory of se_alloc'ated object Jakub Zawadzki (May 03)
- Re: Freeing memory of se_alloc'ated object Max (May 01)
- Re: [PATCH] Re: Freeing memory of se_alloc'ated object Jeff Morriss (May 02)
- Re: [PATCH] Re: Freeing memory of se_alloc'ated object Guy Harris (May 02)
- Re: [PATCH] Re: Freeing memory of se_alloc'ated object Max (May 02)
- Re: [PATCH] Re: Freeing memory of se_alloc'ated object ronnie sahlberg (May 02)
- Re: [PATCH] Re: Freeing memory of se_alloc'ated object Max Dmitrichenko (May 02)
- Re: Freeing memory of se_alloc'ated object Guy Harris (May 01)
