FLEXTool / FLEX

An in-app debugging and exploration tool for iOS

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Some project due to memory burst,and latter crash.

HaoXianSen opened this issue · comments

commented

Environment

  • Platform+version: iOS 16.5.1
  • FLEX version: 5.22.10

Bug Report

In my project, open "menu"、“views”、"select" or any item, due memory burst,and latter crash.

After my analysis, I found, in part, because NavigationController (FLEXNavigationController) internal to the viewController. rightItem or leftItem navigationItem Settings. Views to collapse because of internal call pushViewController: animated: not to set the rootViewController.
The above problems (1) can be solved by setting item in viewDidAppear (2). To resolve this problem, set rootViewController.

The overall structure of my project is window-> navigationController -> tabbarController -> viewController.

It's not clear why: it looks like something is adding cpu in advance. The memory burst and crashed.

commented

I has saved this problem, the reason is NSMutableDictionary safe hook maked memory brust.
[objc_getClass("__NSDictionaryM") gz_swizzleSEL:@selector(setObject:forKeyedSubscript:) withSEL:@selector(gz_setObject:forKeyedSubscript:)];

  • (void)gz_setObject:(id)obj forKeyedSubscript:(id)key {
    if (!obj)
    {
    return;
    }
    if (!key)
    {
    return;
    }
    [self gz_setObject:obj forKeyedSubscript:key];
    }

this will make system constraintsDict can't remove key, and set key's value nil loop。