Re: does Leaks instrument not work correctly with C++?
Re: does Leaks instrument not work correctly with C++?
- Subject: Re: does Leaks instrument not work correctly with C++?
- From: Dave Reed <email@hidden>
- Date: Sun, 01 Mar 2009 21:53:01 -0500
Base SDK: Mac OS X 10.5
Automatic Leaks Checking is checked.
I had been running it on my Intel laptop with no leaks reported.
I just copied the project to my PowerPC machine and ran it multiple
times and get anywhere from 4-7 leaks of 1024 bytes reported. The G5
asked for my administrator password, but the Intel didn't (or at least
hasn't recently while using Instruments - it may have a few days ago
when I was testing my iPhone app).
Went back to the Intel laptop and now I'm getting one leak of 1024
bytes reported (I added a sleep(12) just before the return statement
to make certain it would analyze leaks one more time after it was all
done since I left it set to check every 10 seconds).
Rebooted the Intel laptop, ran it and it asked me for my admin
password, but still only reported one leak of 1024 bytes. Perhaps the
compiler is doing some code optimizations. Went back to my more
complicated example and at least now it's reporting some leaks,
although not as many as it should. Maybe the issue was it hadn't
gotten administrative rights the time before.
Hmm, is it time to uninstall and reinstall the dev tools or will it
not report every single leak?
Thanks,
Dave
On Mar 1, 2009, at 8:50 PM, Ladd Van Tol wrote:
Are you running this program with the Mac or iPhone SDK?
Perhaps you have "automatic leaks checking" turned off in Instruments?
When I run it, it shows 8 leaks before the program exits.
- Ladd
On Mar 1, 2009, at 7:23 AM, email@hidden wrote:
Xcode version 3.1.2 (that came with the 2.2.1 iPhone SDK)
I tried the leak instrument on my iPhone app and was impressed how
nice it was to use - pointed out two small memory leaks I had missed.
I teach C++ programming at the college level and was thinking about
showing my students how to use it (more and more of them have Macs
and we also have a Mac Mini lab), but it doesn't seem to work well
with C++. Am I doing something wrong or this is a known issue?
Here's a simple program that Leaks does not report any leaks
(although you can tell from ObjectAlloc that the memory usage
continued to grow).
#include <iostream>
using namespace std;
int main (int argc, char * const argv[]) {
int *p;
for (int i=0; i<10; ++i) {
cout << i << endl;
p = new int[256];
sleep(2);
}
return 0;
}
Thanks,
Dave
_______________________________________________
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
_______________________________________________
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