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

getAllClasses() goes in a loop #82

Open
andy3a opened this issue Aug 17, 2021 · 8 comments
Open

getAllClasses() goes in a loop #82

andy3a opened this issue Aug 17, 2021 · 8 comments
Assignees
Labels
bug Something isn't working

Comments

@andy3a
Copy link

andy3a commented Aug 17, 2021

Hi Nghia,

I faced with the situation when device/simulator starts consuming huge memory amount and hangs as a result. I don't know why this happens, because this is not a persistent issue and it appears from time to time (I don't see specific cause).

This is the evidence from Debug navigator:
image

And as per profiler looks like getAllClasses is responsible for that:
image
so there are more than 40 000 calls of it...

device iOS version: 14.6 (reproduced for simulators as well)
Xcode: Version 12.5.1 (12E507)

please let me know I should provide some more details

Thanks,
Andrew

@NghiaTranUIT NghiaTranUIT self-assigned this Aug 17, 2021
@NghiaTranUIT
Copy link
Member

Hey @andy3a thanks for your report.

Runtime.getAllClasses() should only be executed once when the app is starting. If it executes multiple times (as your screenshot), I suppose there is a bug somewhere.

I will replace it with a better version and send you a beta this week 👍

@NghiaTranUIT NghiaTranUIT added the bug Something isn't working label Aug 17, 2021
@NghiaTranUIT
Copy link
Member

Just wondering:

  1. Are you using any 3rd-party networking library? such as AFNetworking, or Alamofire? If yes, what version?

I would like to reproduce it in my machine 💻

@andy3a
Copy link
Author

andy3a commented Aug 17, 2021

yes, I'm using Alamofire 5.4.3

@NghiaTranUIT
Copy link
Member

Hey @andy3a if you don't mind, please check out this commit and share with me if it works for you 👍

Changelog

  • Use a different version to get all classes that conforms NSURLConnectionDelegate in runtime

SMP

  • Check out this commit: 70425e4a0895ec483dfdb5b99cfba91bec6ac935

Screen Shot 2021-08-17 at 20 22 06

Cocoapod

pod 'atlantis-proxyman', :git => 'https://github.com/ProxymanApp/atlantis.git', :commit => '70425e4a0895ec483dfdb5b99cfba91bec6ac935'

@andy3a
Copy link
Author

andy3a commented Aug 17, 2021

thanks for you effort @NghiaTranUIT

successfully deployed the commit.

I'll need to use it for couple days to see if the issue can be reproduced unless you know how to reproduce the situation when the issue appeared in previous version

cheers

@andy3a
Copy link
Author

andy3a commented Aug 17, 2021

hi @NghiaTranUIT,

I have reproduced the issue:
image
image
image

@NghiaTranUIT
Copy link
Member

It's odd that this array of AnyClass doesn't release when it exits the function 🤔

@andy3a Please try this commit 29088bc9b752498cdb74051c962855f2de77e52a, which I disable the Method Swizzling on NSURLConnection.

@andy3a
Copy link
Author

andy3a commented Aug 23, 2021

Hi @NghiaTranUIT,

I'm sorry but the issue has been reproduced again.

image

... for the latest fix provided
image

I could provide some details form Profiler if needed. Feel free to request the data you may need for investigation.

p.s. could it be like I do smth wrong? itbh I don't see where I could do anything wrong, but maybe you have an idea...

Andy

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants