更新时间:2021-10-26 22:24:09
我仅在iOS 8上看到相同的问题。在任何版本的iOS 7上都不会发生这种情况。在模拟器上,它的132kb在设备上是144kb。
I'm seeing the same issue on iOS 8 ONLY. It doesn't happen on any version of iOS 7. On simulator its 132kb, on a device its 144kb.
这似乎与以下问题有关:
It seem's to be related to this issue:
https://github.com/AFNetworking/ AFNetworking / issues / 2314
在此示例中,我正在使用nsurlsession执行http get。如果您遇到的地方不发送保持活动状态,即google.com,则不会分配这些kb。但是,如果您碰到发送保持活动状态的地方,则会发送。
I'm performing a http get using nsurlsession in this example. If you hit a place that doesn't send keep-alive, ie google.com, it wont malloc those kb. But if you hit a place that sends keep-alive, it will.
NSString * url = [NSString stringWithFormat:@"%@%.20f", @"http://someplace.com/?test=", (double)[[NSDate date] timeIntervalSince1970];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:url]];
[request setHTTPMethod:@"GET"];
[[[NSURLSession sharedSession] dataTaskWithRequest:request completionHandler:nil] resume];