On Sat, 2005-09-10 at 17:32 +0200, Magnus Fromreide wrote: > I would like to know who it is that actually owns objects > that are passed around.
I'd suggest that, as a basic rule of thumb, objects should be owned by the code module that created them. If memory is allocated by a library routine as part of creating or processing something, then that section of the library should be responsible for releasing it again (either automatically as part of tidying up, or via a suitable free API call). If memory is allocated and passed in from "outside", then "outside" should be responsible for releasing it again. There may well be exceptions to this basic model (in either direction), but they should be clearly documented as such. Keeping allocation and release together seems the most natural and balanced structure, IMO. Dave ------------------------------------------------------- SF.Net email is Sponsored by the Better Software Conference & EXPO September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf _______________________________________________ Net-snmp-coders mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/net-snmp-coders
