Question

I use NSMutableData class in my iOS program. I get unbounded memory growth. I use Automatic Reference Counting. When I used allocation instrument, I saw that NSMutableData's initWithLength: method having Malloc calls in order to allocate memory. Under ARC, memory that is allocated by using malloc should be released by the programmer because ARC doesn't do anything about it. Since I don't know the implementation of NSMutableData class, I can't be sure if the memory allocated by NSMutableData is released when NSMutableData is released. According to the allocations instrument, that's not the case. Does anyone have any knowledge on this?

Another question is when NSMutableData setLength: method is called with smaller size than the current size, then does the extra memory get released?

No correct solution

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top