Re: Memory Leak
Re: Memory Leak
- Subject: Re: Memory Leak
- From: Ladd Van Tol <email@hidden>
- Date: Mon, 26 May 2008 15:31:49 -0700
You'll want to use the MallocStackLogging environment variable while
looking for leaks:
http://developer.apple.com/releasenotes/DeveloperTools/RN-MallocOptions/index.html
- Ladd
On May 26, 2008, at 2:47 PM, Romain Marucchi wrote:
Well that's nice but leaks doesn't tell you where the memory have
been allocated... In other tools that I was using I can get the
filename, line # of where I allocate the memory and the size in byte
etc... I think its really convenient. With leaks its only a memory
dump on the console, which is not really convenient... and make the
process of finding the leaks really hard...
I would definetly suggest that this feature should be added in
Xcode, it can be a simple print on the console or? just showing you
where you initialize the memory (filename, line #, size in byte), as
simple as that...
On May 27, 2008, at 5:23 AM, Arne Scheffler wrote:
On May 26, 2008, at 9:47 PM, Greg Guerin wrote:
Sean McBride wrote:
OK, so one installs an atexit() handler, then what? Use system()
to
invoke the 'leaks' command line tool? I suppose that could
work. But
it's a lot of hocus pocus for someone new to the platform.
My point was only that competing IDEs (ie Visual Studio)
essentially do
this magic for you, and that I think it would be a great feature
for
Xcode to have.
It *would* be a nice addition.
Apple doesn't have to write it, and it doesn't have to be built
into Xcode.
Someone with experience could write it and make it available to all.
This is what I'm using, just run the function last in your main
function.
#include <sys/types.h>
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
extern "C" {
extern void __do_global_dtors (void);
}
void runLeaksAtExit (void)
{
__do_global_dtors ();
char command[10240];
pid_t pid = getpid ();
sprintf (command, "leaks %d", pid);
system (command);
}
arne
_______________________________________________
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
_______________________________________________
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