tags:

views:

758

answers:

1

I'm new to development using Xcode, and am having trouble using the built-in Leaks Instrument.

I have enabled guard malloc and put MallocStackLogging YES & MallocStackLoggingNoCompact YES in the environmental variables for the executable. Then running the process by clicking

Run->Start with performance tool->Leaks

But only object allocations show in the UI, In the leaks frame all it says is "Analyzing process" (I have left it for over 20mins like this with no change)

I deliberatly created a leak in main()

void * leak = malloc(100);
    leak=NULL;

but no change

If i run from the console

  ~$ leaks ProcessName

It correctly reports

Process 1014: 223344 nodes malloced for 9017 KB
Process 1014: 1 leak for 112 total leaked bytes.
Leak: 0x100100020  size=112 string ''
    Call stack: [thread 0x7fff70767720]: | start | main | malloc | malloc_zone_malloc

but does anyone know why the UI won't show the same thing?

Thanks

+2  A: 

The problem seems to be compiling the app as 64 bit. A simple test Xcode project

#include <iostream>

void leaks(){

    char * newleak = (char* ) malloc(2000);

    return;
}

int main (int argc, char * const argv[]) {

    void * leak = malloc(100);
    leak = NULL;


    while(1){
     leaks();
     sleep(10); 
    }

}

Leaks will display correctly if architecture is i386 however if i compile as x86_64 (64 bit math required) it will hang on "Analyzing process". Is there something i'm doing wrong here? I'm using a Intel Core 2 Duo macbook pro

zootreeves