Wireshark-dev: Re: [Wireshark-dev] [PATCH][UPDATE] ptvcursor : one step further?

From: Guy Harris <guy@xxxxxxxxxxxx>
Date: Sun, 11 Mar 2007 13:19:14 -0700
Sebastien Tandel wrote:

About the memory leak with g_renew, you're right of course.
"Unfortunately" there is no ep_realloc ... is there any reasons to /not/
implement one ? I've no idea of the complexity to implement one either ...

"realloc" is usually defined as to "allocate new, copy, free old" - and implementations might have an optimization, such that if there's enough free space after the existing item, it'll just be extended into that space, with no copy necessary.

There's no "ep_free()" (by design), so "ep_realloc()" would be "allocate new, copy" - and I think that the optimization might be implementable, although it'd only work for the most recently allocated item.

So, no, I don't see any reason not to implement ep_realloc().