Are there any exceptions to the established allocation rules with the 2016 API?


#1

It seems like every SU*ReferenceType*Get*AttachedType* function doesn’t require any explicit calls to a corresponding SU*AttachedType*Release function.

Rather, the user is responsible for explicitly freeing memory if they’ve explicitly created it without any prior ownership, via SU*SomeType*Create.

My understanding is that responsibility is also delegated, however, if the allocated type is attached to something like a GroupRef, Entities, or ComponentInstanceRef type; freeing the parent of the allocated type will in turn free the allocated type (and so on and so forth down an arbitrary hierarchy).

Are there any exceptions to this rule, or is management handled this way throughout all of the API?


#2

That’s the general rule but there are a few exceptions. We tried to explain these under the Memory Management section here:

http://extensions.sketchup.com/developer_center/sketchup_c_api/sketchup/index.html

I know the rules must seem a bit arbitrary so if you have specific questions, please let us know.