Skip to content
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

Errors in console related to objc_disposeClassPair. #283

Closed
NickolaySheika opened this issue Feb 15, 2016 · 3 comments
Closed

Errors in console related to objc_disposeClassPair. #283

NickolaySheika opened this issue Feb 15, 2016 · 3 comments

Comments

@NickolaySheika
Copy link

I always receive this kind of message in console when trying to create class mock and mock class method:
objc_disposeClassPair: class 'Mockup-0x10f9de260-116683599' still has subclasses, including 'Mockup_Mockup_'!

Error appears after objc_disposeClassPair call in this method of OCClassMockObject.m:

- (void)stopMocking
{
    if(originalMetaClass != nil)
    {
        /* The mocked class has the meta class of a dynamically created subclass as its meta class,
           but we need a reference to the subclass to dispose it. Asking the meta class for its
           class name returns the actual class name, which we can then use to look up the class...
        */
        const char *createdSubclassName = object_getClassName(mockedClass);
        Class createdSubclass = objc_lookUpClass(createdSubclassName);

        [self restoreMetaClass];

        objc_disposeClassPair(createdSubclass);
    }
    [super stopMocking];
}
@erikdoe
Copy link
Owner

erikdoe commented Mar 23, 2016

Let's see what happens with #285. If we end up using a cache in all cases, then this problem would disappear, because we'd never dispose the subclasses.

@erikdoe
Copy link
Owner

erikdoe commented Jul 27, 2016

With iOS 9.3 the slowness problems reported in #253 have disappeared. Therefore, the workaround for these issues proposed in #285 isn't necessary anymore. That in turn means that we should look at this issue again, even though it seems mostly cosmetic.

Could you provide more details, or maybe even a self-contained example that shows the behaviour you are describing. Personally, I have not seen it. Are you using other libraries/frameworks that may impact retention of objects?

@erikdoe
Copy link
Owner

erikdoe commented Feb 16, 2020

Assuming fixed by now.

@erikdoe erikdoe closed this as completed Feb 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants