Instruments (Leaks) and NSDateFormatter

后端 未结 3 1158
故里飘歌
故里飘歌 2021-01-13 23:57

When I run my iPhone app with Instruments Leaks and parse a bunch of NSDates using NSDateFormatter my memory goes up about 1mb and stays even though these NSDates should be

3条回答
  •  囚心锁ツ
    2021-01-14 00:13

    [df setDateFormat:@"EEE, d MMM yyyy H:m:s z"]; // Remove the `z`
    

    868 Kb will be permanently allocated on iPhone OS 2.2.1 or 3.1.2 (more to come) after a single invocation to "dateFromString" when the z option is used.

    A complete article with source code and log file can be read at http://thegothicparty.com/dev/article/nsdateformatter-memory-leak/

提交回复
热议问题