So this question may be invalid, depending on my understanding,
But let's say we have an object on the heap, say at 0x618000001234
If I use Xcode's memory debugger, to view the memory at that address, I just see a bunch of information, right?
Now as far as my understanding goes, the first thing you will find at that address is the isa
pointer, which is a Class
AKA objc_class
and it looks like that just takes up 8 bytes
It looks like the contents of isa
is:
011DFFFF9C1B89F9
Great, fine and dandy
So let's say we have a class
@interface testClass : NSObject
@property int testIntProperty;
@end
Assuming there is nothing in memory after the isa
, and it goes straight into the properties,
if we looked at the location in memory, of an instance of testClass
,
I would expect the first 8 bytes to be the isa
, then the next 4 bytes to be the int
property, and then the rest doesn't matter
So my question is:
In that example, we can tell that the testIntProperty
will be located 8 bytes from the start of the object, just by looking at the header of the property
But is there a way to tell exactly where it's going to be, say if there are 10 properties, and you want to know where the 10th property is?
The reason why I'm asking, is because I want to look at a specific property's pointer, and I'm having a hard time finding it in memory. At runtime, I get an EXC_BAD_ACCESS, with address 0x18
, but I'm curious to actually look in memory at the location I expect that property to exist at, and I want to see the 0x18 in plain sight