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

BHAnnotation中dyld_callback会被多次调用 #141

Open
Zss1990 opened this issue Jul 17, 2019 · 1 comment
Open

BHAnnotation中dyld_callback会被多次调用 #141

Zss1990 opened this issue Jul 17, 2019 · 1 comment

Comments

@Zss1990
Copy link

Zss1990 commented Jul 17, 2019

Annotation方式注册方式中使用了
void initProphet() { _dyld_register_func_for_add_image(dyld_callback); }
dyld_callback被回调次数非常多,如果注册的比较多的话会不会引起性能问题?

@EdgarDegas
Copy link

EdgarDegas commented Mar 30, 2024

注册是在运行前发生的,所以无所谓;BHModuleManager.registerDynamicModule 在注册的时候是去重的,所以也不会影响运行时的性能。

__block BOOL flag = YES;
[self.BHModules enumerateObjectsUsingBlock:^(id  _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
    if ([obj isKindOfClass:class]) {
        flag = NO;
        *stop = YES;
    }
}];
if (!flag) {
    return;
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants