MozillaZine

Full Article Attached New Memory Management Plan for Feedback

Saturday May 8th, 1999

Rick Gessner, Director of Engineering of NGLayout at Netscape, is calling for standardization in Mozilla's memory management techniques. If you are a mozilla developer, please read this, and post any comments to Rick's duplicate post in the layout newsgroup. Click Full Article below to read Rick's report.


#5 Re:New Memory Management Plan for Feedback

by mark rawling <mwr@npec.netscape.com>

Monday May 10th, 1999 1:05 PM

You are replying to this message

If you can't use exceptions then you'd almost be better off banning pointers altogether. Use smart pointers, auto pointers and references everywhere. Or maybe even change new() to never return NULL unless there really is no more memory, in which case you can panic there. Otherwise all the checking and specical casing will make the code bloated, buggy and impossible to comprehend.

As for exceptions, you can establish rules for object ownership and transfer thereof so that a generic goto error label will know how to clean up before returning an error code. Error checking then becomes a simple, unobtrusive macro. Or how about adding an exception arg to (most) every funtion? The jmc approach. It's ugly but it works.