On Fri, Aug 23, 2013 at 12:44:49PM +1200, Tony van der Peet wrote:
> 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().

No.

> Reasons for doing this are:
> 
> - consistency with other memory allocation routines

The name xmalloc() has a history that dates back over 20 years, to at
least GCC 1.42 released in 1992, and probably long before that.  The
'x' prefix (which possibly stands for "extended") has now come to
canonically indicate a function that aborts the program if the primary
function indicated by the remainder of the function name fails.  There
is no such history for xfree() and it does not fit the pattern.

> - 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.

You can do this without such treatment.

> So, how about it?

No.
_______________________________________________
discuss mailing list
discuss@openvswitch.org
http://openvswitch.org/mailman/listinfo/discuss

Reply via email to