I have a huge NSMutableData object(approximately 1 MB in size) in memory and now I want to replace all the bytes in the object to 0 (not deallocate the memory). The resetBytesInRange method lets me do this. However how do I verify/check if the bytes are actually set to 0. I want to look at the memory addresses and confirm this. Is this possible?
I have the following code
NSMutableData *imgData = [NSMutableData dataWithCapacity:50000000];
imgData = (NSMutableData*)UIImageJPEGRepresentation(img, 1.0);
[imgData resetBytesInRange:NSMakeRange(0, [imgData length]) ];
Now when I look into the address pointed to by imgData (and the following few locations), before and after the resetBytes, I do not see any change in the values in the memory locations starting from the address pointd to by imgData (I expected to see zeros assigned). I assumed that the memory allocations are contiguous starting from the the address pointed to by imgData (upto [imgData length]). Is this assumption corerct (which seems like it is not)? If not where are the bytes in the NSMutableData object stored? Can I access them individually?
Thanks
Vivek