Subject: Re: Making a common API for cpu frequency drivers To:
Juan RP <> From: Jason Thorpe <> List: tech-kern Date:
09/01/2006 15:56:43 On Sep 1, 2006, at 3:15 PM, Juan RP wrote:
> Do I need to release references with every obj used in the
code?   From the proplib(3) manual page:        The rules for
managing reference counts are very simple:        o   If you
create an object and do not explicitly maintain a   reference to
it, you must release it.        o   If you get a reference to an
object from other code and wish   to main-           tain a
reference to it, you must retain the object.  You are
sible for releasing the object once you drop that reference.
o   You must never release an object unless you create it or
retain it.  So, take the following example:  foo(device_t dev)
prop_number_t num;          num =
prop_dictionary_get(device_properties(dev),          /* ... do
something ... */  You did not need to manipulate the ref count
because you did not   maintain a reference outside