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: Tue, 04 Apr 2006 11:01:46 -0700
David Dunham wrote:
On 3 Apr 2006, at 17:49, John Draper wrote:
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.
Yes, of course you can remove it later. Though it's easiest to simply
uncheck it in that dialog, so you can turn it on again as needed. (In
my normal work, I leave it on so I can check for leaks as fancy takes
me, since the performance penalty isn't noticeable.)
yes - I intend to do the same thing.... but when I bring up the
console, I get a lot of this...
Looking for devices matching vendor ID=1193 and product ID=8718
Looking for devices matching vendor ID=1193 and product ID=8717
Looking for devices matching vendor ID=1193 and product ID=8718
Looking for devices matching vendor ID=1193 and product ID=8717
Looking for devices matching vendor ID=1193 and product ID=8718
What is this? and why am I getting this? This keep outputting constantly,
making it very difficult to see any other console output.
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?
Right, something lke "leaks MyApp >leaks.txt"
Oh, right - piping it into a file.
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.
The former assumes you're Cocoa... I don't think either one is
relevant to leak-finding.
I remember the tech note mentioning it. All I can do is read the tech
notes and docs. I CANNOT
read between the lines, which I'm finding out, is a skill that is much
required when dealing with
the somewhat incomplete Apple Dox.
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
This looks like "leaks" but without a stack trace, so perhaps with a
release build.
I have NO CLUE what you're talking about.... could you elaborate on
that? Do you
mean this is output from a release build? I looked at the stack
trace, I just didn't
send it. Besides, this was just an example and output from something I
had copied
and pasted to illustrate what I was talking about. But if you want to
see one, here
it is... and this one is the actual one...
Call stack: [thread 8bd7]: | 0x0 | _dyld_start | _start | main |
0x92eba25c | 0x92ecbbe8 | 0x92eba3f4 | 0x92e3b55c | 0x92ee42f8 |
0x92df28bc | 0x90a2e750 | -[mySipController awakeFromNib] | -[SipBridge
initWithController:] | resip::infoServer::infoServer() |
_ZN5resip10infoServerC4Ev | operator new(unsigned long) | malloc |
malloc_zone_malloc
I looked at my source code, but what is this?
"_ZN5resip10infoServerC4Ev" I don't have such
a class or function. How can I interpret this? I know the previous
one... the code is...
mInfoServer = new infoServer;
mInfoServer->SetServerInfo(self, serverport, serverport,
"213.167.79.25", "213.167.79.20");
Is this the statement that correllates to
"resip::infoServer::infoServer()" when I construct my
"InfoServer" object? I dived into this one, I could not find ANYTHING
that relates to this
"_ZN5resip10infoServerC4Ev" I'm getting, whats up with this?
I also get the same thing from the MallocDebug application, and when I
click on the source file,
icon, it brings up a completely different module having totally nothing
to do with the InfoServer
or any methods or functions it calls.... STRANGE....
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?
It does partial matching, so I typically use the first several
characters rather than looking up process ID with "ps" or "top."
Right - either appears to work....
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