문제

How can I force NSMutableData to reserve contiguous memory, in the same section? I have a fair amout of data arriving piece by piece, and the performance is not satisfactory. The total size of my data will be constant.

도움이 되었습니까?

해결책

NSMutableData should store all data contiguously. Internally it is using a "stretchy" buffer resized with realloc. You can create with [NSMutableData dataWithLength:];

Why not use an NSData if the size is constant?

Also why are you worrying about NSMutableData performance. Did instruments profile show a performance problem?

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top