Re: More memory bugs


Subject: Re: More memory bugs
From: Jesper Skov (jskov@cambridge.redhat.com)
Date: Sun Mar 18 2001 - 03:46:05 CST


>>>>> "Mike" == Mike Nordell <tamlin@algonet.se> writes:

Mike> Instead of just quietly fixing this, I had to go on ranting
Mike> about it. ev_Menu_Labels.cpp v. 1.16 got a nasty
Mike> bug. Potentially a killer if left as-is. Even Dom that updated
Mike> that file to 1.17 missed that bug. May I humbly suggest that if
Mike> using strings in this way, and don't know the difference between
Mike> malloc/calloc & new, use the string class UT_String I added.

Mike> I've apparently forgotten how challanging memory management can
Mike> be to some, why I after seeing this bug reintroduced for the
Mike> 4711:th time suggests that this micro-management of memory
Mike> should be forwarded to some entity that ease the burden off you:
Mike> UT_String. I actually think we should throw UT_cloneString away
Mike> and never look back.

FWIW, IMO we should only have one string alloc/free scheme. If it's
packed away in a dedicated class, all the better.

I just did a grep for malloc/calloc over the sources, and quite a few
of those are used for strings. I haven't looked at your string class,
Mike, but would it be suitable for all instances of string usage in
AbiWord? If so, I think we should change them all to use it, and put
it as a coding style requirement.

Jesper



This archive was generated by hypermail 2b25 : Sun Mar 18 2001 - 03:46:27 CST