On Mon, Mar 2, 2015 at 1:12 PM, Darryl L. Pierce <dpie...@redhat.com> wrote:
> Do I need to use reference counting from within the Proton library even
> though I'm writing in a language that doesn't use them?
> I asked because I see calls to pn_incref/pn_decref in the Python
You are implicitly using reference counting whenever you use the C API. Any
proton object constructed via the C API has an initial reference count of
1, and most "pn_<blah>_free" methods are just aliases for pn_decref.
Whether or not you need to explicitly use pn_incref/pn_decref at any point
other than these times depends on your overall scheme for managing memory.
If two ruby objects will ever share a reference to the same C object, then
explicitly using pn_incref/pn_decref is likely the most sensible way to
manage things. If however you are maintaining a one-to-one mapping between
ruby wrapper and C object, then you may not have to use pn_incref/decref