I come from a microcontroller programming world, and I am learning to program on iOS,
I have a question that is being bothering me:
-
how to know the physical address of a the memory allocated to an object?
NSString *nombre = [[NSString alloc] initWithString:@"nombreName"];
like the hexa address?? where to see this?
- how big is the heap? can I see the heap at the beggining and after allocating to the objects?
Use gdb to inspect objects at runtime while debugging.
I’ve created a simple UIView object as,
and set a breakpoint on this line,
Stepping over this line so that someObject’s memory is allocated, and then run
poor print object on gdb shows the hex address of this object –0x9304090.If the object’s
descriptionmethod has been overridden, you may not see the hex address. For those objects, simply print the pointeror cast it to an int to see the memory location as a decimal.