appcelerator/hyperloop-common — pull request #44 by infosia (2014-07-02 14:30:49+00:00)
Title: Add flag to indicate object ownership

For `Hyperloop::NativeObject` objects, not all object memory should be deleted on `release()`. For example, `struct` pointer which is newly created and allocated at NativeObject constructor should be deleted on release, but `void*` pointer which is allocated through `malloc` should be deleted explicitly by calling `free(void*)` by developer and NativeObject is not responsible for deleting it.

So, `NativeObject` should have flag which indicates object ownership to make it decide if it can call free on release.

```c++
template<>
inline void Hyperloop::NativeObject::release()
{
if (this->owning) {
free(this->object);
}
delete this;
}
```