Total Size of NSMutableArray object

后端 未结 5 1753
盖世英雄少女心
盖世英雄少女心 2021-02-06 21:55

I\'ve got an NSMutableArray that holds a bunch of objects, what I\'m trying to figure out is how much memory is the array using. After looking at a cou

5条回答
  •  南方客
    南方客 (楼主)
    2021-02-06 22:15

    To get the number of objects in the array, use

    [temp count]
    

    If you want the total memory usage of the array, you'll have to loop through and add up how much memory each object uses, but I don't think that a generic object will give you its size. In general, you shouldn't really have to worry about memory usage, though.

提交回复
热议问题