• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: problem with LEAKS and the stack trace
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: problem with LEAKS and the stack trace


  • Subject: Re: problem with LEAKS and the stack trace
  • From: Nathan Smyth <email@hidden>
  • Date: Sun, 24 May 2009 01:10:06 +0000 (GMT)


>A question: having chosen the executable and setting parameters, did you then hit record--the button with a red dot in the middle.  You need that to start; you >should then see a broad blue line progressing right to left as the program executes with orange markers showing points where problems are found.  Click one of >those and you will get a boatload of information.

For me, the mousepointer just spins around (goes busy) and I eventually have to kill 'instruments'.
Maybe something to do with threading? It is a spawned proc which causes the leaks. Though can't get there anyway cos it crashes on 'record' (even checking the processes (ps -ef) I can see it hasn't properly executed).


> Have you tried clang?
>it's pretty helpful in identifying sources of leaks in programs.

I'm actually debugging a hacked PostgreSQL - it isn't setup as a nice XCode project (seems at an initial glance that's what Clang needs??)


In any case, I thought enabling MallocStackLogging should give the stack trace when running leaks? no?

Thanks



From: dct <email@hidden>
To: Xcode-Users Users <email@hidden>
Cc: Nathan Smyth <email@hidden>
Sent: Saturday, 23 May, 2009 23:07:02
Subject: Re: problem with LEAKS and the stack trace

Nate

I'm no expert but Instruments has proven to be a good tool for my purposes.

A question: having chosen the executable and setting parameters, did you then hit record--the button with a red dot in the middle.  You need that to start; you should then see a broad blue line progressing right to left as the program executes with orange markers showing points where problems are found.  Click one of those and you will get a boatload of information.

Don

On May 23, 2009, at 2:43 PM, albert jordan Mobility wrote:

Nate,

Have you tried clang?

http://www.oiledmachine.com/posts/2009/01/06/using-the-llvm-clang-static-analyzer-for-iphone-apps.html

it's pretty helpful in identifying sources of leaks in programs.

Albert



On May 23, 2009, at 11:52 AM, Nathan Smyth wrote:

Hi there,

I  have a program which leaks a LOT of memory, so I am trying to debug it.

On execution, it spawns a few processes, one of which causes the problem.

I run leaks on the pid and I see that mem is leaking:
i.e. I get output like

c088:Clients blah$ leaks 21182
Process 21182: 3526 nodes malloced for 2602 KB
Process 21182: 25 leaks for 448 total leaked bytes.
Leak: 0x701170  size=32    string '/tmp/.s.PGSQL.5432.lock'
Leak: 0x71d610  size=32    string 'investigation_ended'
Leak: 0x71d960  size=32    string 'under_investigation'
....

The issue is that I can't get to the stack trace to find out where these occur!

I have set the MallocStackLogging environment variable in the shell, which I know works as 
every command gives me 
ls(21194) malloc: stack logs deleted from /tmp/stack-logs.21194.ls.9p95Ur

If I use malloc_history I get nothing...
c088:Clients blah$ malloc_history 21182 0x701170088:
blah$ 

Though if I gdb connect to the process, I can catch the line of code for segfaults, for e.g.

Any ideas of how I can help find the erroneous allocations.

THanks Nafe

PS I TRIED using  Instruments.app. I chose the executable and set the relevant parameters which should spawn the processes. But once I click run it just sits there. Doesn't seem to be an option
 _______________________________________________
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

  • Prev by Date: target duplication with AppleScript
  • Next by Date: Drawing something in UIViewController?
  • Previous by thread: Re: problem with LEAKS and the stack trace
  • Next by thread: how access "Custom BUild Tool" Target properties via AppleScript
  • Index(es):
    • Date
    • Thread