New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[iOS] Memory leaks with instance created by rb_class_wrap_new() #59
Labels
Comments
Watson1978
added a commit
that referenced
this issue
Dec 5, 2016
`class_createInstance()` fills following structure fields properly. ``` struct objc_class { Class isa OBJC_ISA_AVAILABILITY; #if !__OBJC2__ Class super_class OBJC2_UNAVAILABLE; const char *name OBJC2_UNAVAILABLE; long version OBJC2_UNAVAILABLE; long info OBJC2_UNAVAILABLE; long instance_size OBJC2_UNAVAILABLE; struct objc_ivar_list *ivars OBJC2_UNAVAILABLE; struct objc_method_list **methodLists OBJC2_UNAVAILABLE; struct objc_cache *cache OBJC2_UNAVAILABLE; struct objc_protocol_list *protocols OBJC2_UNAVAILABLE; #endif } OBJC2_UNAVAILABLE; ``` Our `klass` in `struct rb_class_ptr` covers `isa` of `struct objc_class`. If store a value in `klass`, it will break `isa`. And then we cannot call Objective-C method on its instance.
Watson1978
added a commit
that referenced
this issue
Dec 6, 2016
Watson1978
added a commit
that referenced
this issue
Dec 6, 2016
Watson1978
added a commit
that referenced
this issue
Dec 15, 2016
When container and child have a relationship, we have to retain a child object. If not, a child object will be released.
Watson1978
added a commit
that referenced
this issue
Dec 19, 2016
Watson1978
added a commit
that referenced
this issue
Dec 19, 2016
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
We allocate instance using
class_createInstance()
on Darwin.We have to call
- [obj autorelease]
where create an instance to avoid memory leak on Darwin, likeHowever,
class_createInstance()
isThe text was updated successfully, but these errors were encountered: