Re: Seeking advice on debugging "real time" programs.
Re: Seeking advice on debugging "real time" programs.
- Subject: Re: Seeking advice on debugging "real time" programs.
- From: John Draper <email@hidden>
- Date: Mon, 03 Apr 2006 17:49:08 -0700
David Dunham wrote:
On 3 Apr 2006, at 14:19, John Draper wrote:
Using "MallocDebug" is fine when dealing with "not so critical"
timing issues,
but when inside a RTP Thread where timing is everything, these
tools can
slow down the application so much it breaks the timing.
You can find leaks by setting the MallocStackLogging environment
variable, but this does take time (and memory).
Ok, and If I do that through X-Code, can I just remove that statement
later? In My case, I would
go into the Executables --> myApp and click "Get Info" icon, pick
Arguments tab and enter in
MallocStackLogging 1 as illustrated in
http://developer.apple.com/technotes/tn2004/tn2124.html#SECINTRO
Figure 1.
I'm still stuck to using X-Code 1.5, so for any new feature
available in the 2.X
series is not going to do me much good.
Why are you stuck?
First off, I don't have enough Disk space on my laptop to support the
upgrade.
But if I can show this working, getting better equipment won't be an issue
later on. Right now, I only have a G3 Wall St laptop (First one
released with
a Firewire and USB port).
* Performance testing (Shark), but don't know what I'm looking
for... :-(
But Shark will tell you what you're looking for.
yea - but I need to understand how to interpret the data. But first, I
need to understand how
to use Shark. I saw it used at the WWDC but that was on X-Code 2.1. I
need more time to
research this.
Has anyone on this list come up with an effecive way to identify and
isolate
memory leaks? Is there still hope for me as an X-Code 1.5 user?
Sure, set MallocStackLogging and then use leaks from the command
line. (You'd set a breakpoint at a spot when you expect memory to be
cleaned up -- in my case at the end of main().)
So - how do I do this? First I launch my program under X-Code, and
stop at my desired breakpoint?
Then, would I use the "leaks" shell command at that point? which would
display data not unlike some
of the sample I included below?
Some of the guidelines also recommended I break on -[NSException raise]
and malloc_printf. Is it good
to put breakpoints at both, or one at a time? They didn't say in the
App Notes.
There are several places I need to check...
1) right after AwakeFromNIB. (Baseline).
2) Right after sucessful "SIP REGISTER".
3) Right after sucessful "INVITE" but before starting the audio streaming
4) During streaming, to insure I'm not allocating any memory during my 40 ms
timing intervals. Once I break, I cannot continue, due to the "real
time"
nature of the application.
5) After "Ending" the RTP session
6) After "Ending the Invite dialog"
7) After logging off.
Some things I might mention... I'm using two external Libraries (Linux) but
building them as .a Libraries in X-Code. One is the "resiprocate" SIP
stack,
and the other is the JRTPLIB. Both written in C++, but built as seperate
libraries included into a "test" application built with full symbols.
Later on, as I get the code working properly (Including allocation issues),
I built a non-symbol version for my deployment build.
Most of these can just easily involve a breakpoint, then examination of
the heap.
But then, #4 above is the challange... how to break into the
mid-streaming and
examine memory, then being able to re-start again and have it continue
to see
if anything is left on the heap. Once I break in the middle of a RTP
Streaming
session, it is impossible to continue where it left off, because the
next RTP
packet would have a timestamp much much later all of a sudden and program
will exit or the connection is broken. Perhaps I might be able to
"Fool" the
RTP into continuing.
How do I generate this output (Below)... I had done this more then a
year ago,
but like a fool, I did not document what I did to generate this
output.
Process 3499: 8 leaks for 160 total leaked bytes.
Leak: 0x00569160 size=32 string 'James'
Leak: 0x00569140 size=32 instance of 'NSCFString' - 'James'
0xa01905f4 0x000107ad 0x00569160 0x00000011
0x00000020 0x00000020 0x0059b680 0x00000000
Leak: 0x00568a20 size=16 instance of 'NSCFString' - '52'
0xa01905f4 0x0001078c 0x02353200 0x00020000
Leak: 0x0056ede0 size=16 instance of 'NSCFString' - '9778'
0xa01905f4 0x0001078c 0x04393737 0x38000000
Leak: 0x005887e0 size=16 instance of 'NSCFString' - '153223'
0xa01905f4 0x0001078c 0x06313533 0x32323300
Leak: 0x0058b220 size=16 instance of 'NSCFString' - '233'
0xa01905f4 0x0001078c 0x03323333 0x00010001
Leak: 0x00511d10 size=16 instance of 'NSCFString' - '37'
0xa01905f4 0x0001078c 0x02333700 0x00010001
Leak: 0x005074f0 size=16 instance of 'NSCFString' - '67'
0xa01905f4 0x0001078c 0x02363700 0x00010001
Is this the "leaks" shell command? Where do I get the "pid", is that
from the "ps -ax" command? "man leaks" also mentions I can use
the application name? Is that the same name as file with the .app
extension? or my executable target name? So if my App is named
"SipApp" can I do... % leaks SipApp and see this output? But
I would only be able to do that if and only if I set the
"MallocStackLogging" to 1, right?
John
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden