Tracking down memory leaks
I would like to associate the code I'm executing with a specific memory consumption figure.
That is, I would like to do something like this:
-(void) function
{
long memory_status = sizeofheap();
long new memorystatus;
do somestuff();
new memorystatus = sizeofheap();
NSLog(@"We've done new stuff, and our stack was %ld bytes long and now we have %ld bytes, or a difference of %ld",
memory_status, new memorystatus, memory_status - new memorystatus);
}
I don't know why but I have done millions of searches and still have no clue as to how to do this ... and yet there must be a way ... right?
Or is there any way to do this?
mark ininstruments("Where we start"); and have "where we start" appear somewhere in instruments as a marker I could visit, like markers in Final Cut Pro?
It seems extremely difficult for me to associate a specific time in Instruments to code executing and I've spent hours and hours on this problem without any success.
Many thanks for any ideas.
D
That is, I would like to do something like this:
-(void) function
{
long memory_status = sizeofheap();
long new memorystatus;
do somestuff();
new memorystatus = sizeofheap();
NSLog(@"We've done new stuff, and our stack was %ld bytes long and now we have %ld bytes, or a difference of %ld",
memory_status, new memorystatus, memory_status - new memorystatus);
}
I don't know why but I have done millions of searches and still have no clue as to how to do this ... and yet there must be a way ... right?
Or is there any way to do this?
mark ininstruments("Where we start"); and have "where we start" appear somewhere in instruments as a marker I could visit, like markers in Final Cut Pro?
It seems extremely difficult for me to associate a specific time in Instruments to code executing and I've spent hours and hours on this problem without any success.
Many thanks for any ideas.
D
MacBook Pro 2.4ghz; iPhone with version 2.0 software, Mac OS X (10.5.4)