[ovs-discuss] Suggestion: wrap free() just like malloc(), etc

Tony van der Peet tony.vanderpeet at gmail.com
Fri Aug 23 00:44:49 UTC 2013


While I have been following this list for a while, I am not totally up to
speed with the ins and outs of contributing to the cause.

I want to propose that we should wrap free() just like the other memory
allocation routines are. In other words, create an xfree() in util.c and
call that instead of free().

I have yet to set up a development environment that will allow me to make
this change and submit the patch, but will do so if this change is going to
be accepted.

Reasons for doing this are:

- consistency with other memory allocation routines
- foreshadow possible memory allocation/deallocation auditing

On the second point, the way that I would do this is to change x...()
routines into macros that pass __FILE__ and __LINE__ to other routines
(call them _x...()) which are then able to track allocation and
deallocation by file name and line number. This proves useful in tracking
memory leaks. But of course free() has to have the same treatment.

So, how about it?

Regards
Tony
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://openvswitch.org/pipermail/ovs-discuss/attachments/20130823/74288389/attachment.html>


More information about the discuss mailing list