The plist file is stored as text, one character occupies one byte, and the head of the plist file is occupied, which is the total number of characters.
The amount of space loaded into memory is the same as the file size.
For example, a string below is 300 characters. 10,000 objects are stored in a file with a file size of 3.2MB. 3.2MB of space to load into memory
- (void) viewdidload {[Super viewdidload]; //additional setup after loading the view, typically from a nib.Nsmutablearray *array =[[Nsmutablearray alloc] init]; for(intI=0; i<10000; i++) {[Array addobject:@"ADSJADSLKJFKSDAJFKLASJDKFKALSDKLFADSJADSLKJFKSDAJFKLASJDKFKALSDKLFADSJADSLKJFKSDAJFKLASJDKFKALSDKLFADSJADSLKJFKSDAJFK Lasjdkfkalsdklfadsjadslkjfksdajfklasjdkfkalsdklfadsjadslkjfksdajfklasjdkfkalsdklfadsjadslkjfksdajfklasjdkfkalsdklfadsjads lkjfksdajfklasjdkfkalsdklfadsjadslkjfksdajfklasjdkfkalsdklfa300"]; } Nsarray*paths =nssearchpathfordirectoriesindomains (NSDocumentDirectory, Nsuserdomainmask, YES); NSString*documentsdirectory = [Paths Objectatindex:0]; NSString*filename =@"1.plist"; NSString*filepath =[Documentsdirectory Stringbyappendingpathcomponent:filename]; NSLog (@"path is:%@", FilePath); [Array Writetofile:filepath atomically:yes]; Nsarray*ARR2 =[Nsarray Arraywithcontentsoffile:filepath]; SELF.ARR2=arr2; NSLog (@""); }
iOS plist files and takes up space when loaded into memory