> The "hello, world" console app just prints one line of text and exits.
> To track memory leaks in an app, the app has to be running (and
> preferably doing something).
Understood ! that was a bit stupid of myself..., now I got it to do
something: create a memory leak and loop indefinitely. But still,
MallocDebug fails to detect the leak .... Any ideas why (see code below)
//
void leak(int size)
{
char *buff = malloc(size);
}
int main(int argc, char *argv[])
{
printf("Hello World, this is CodeWarrior!\n");
leak(100000);
// Do something ... Or at least pretend
do
{
;
}while(1);
return 0;
}
//
> It should not be necessary to remove any libraries from the program
> being tested: just launch it within MallocDebug.
True and false : if you link against 'MSL All Mach O.lib', you can't use
MallocDebug : you get an error because the _exit symbol if defined twice.
You need to use a combination of the 'MSL C++ - BSD -MachO.lib' and the 'BSD
Runtime.lib'.
>MallocDebug will
> ensure that the debug malloc library is loaded into the program's
> space. All memory allocations end up calling the System's malloc
> routine eventually; so if a program is leaking memory, MallocDebug will
> show where the leaking allocations were made.
I knew that , thanks.
> Greg
Bruno
Ben Artin - 08 Sep 2005 23:45 GMT
> True and false : if you link against 'MSL All Mach O.lib', you can't use
> MallocDebug : you get an error because the _exit symbol if defined twice.
> You need to use a combination of the 'MSL C++ - BSD -MachO.lib' and the 'BSD
> Runtime.lib'.
True. (libgmalloc loses similarly)
Ben

Signature
If this message helped you, consider buying an item
from my wish list: <http://artins.org/ben/wishlist>
I changed my name: <http://periodic-kingdom.org/People/NameChange.php>
Eric Albert - 09 Sep 2005 04:06 GMT
> > True and false : if you link against 'MSL All Mach O.lib', you can't use
> > MallocDebug : you get an error because the _exit symbol if defined twice.
> > You need to use a combination of the 'MSL C++ - BSD -MachO.lib' and the 'BSD
> > Runtime.lib'.
>
> True. (libgmalloc loses similarly)
Is this still true on Tiger?
-Eric

Signature
Eric Albert ejalbert@cs.stanford.edu
http://outofcheese.org/
Ben Artin - 09 Sep 2005 04:49 GMT
> > > True and false : if you link against 'MSL All Mach O.lib', you can't use
> > > MallocDebug : you get an error because the _exit symbol if defined twice.
[quoted text clipped - 5 lines]
>
> Is this still true on Tiger?
Haven't checked, and I am moving to Xcode anyway so I doubt I'll take the time
to do so :-)
Ben

Signature
If this message helped you, consider buying an item
from my wish list: <http://artins.org/ben/wishlist>
I changed my name: <http://periodic-kingdom.org/People/NameChange.php>
Eric Albert - 09 Sep 2005 18:23 GMT
> > > > True and false : if you link against 'MSL All Mach O.lib', you
> > > > can't use MallocDebug : you get an error because the _exit
[quoted text clipped - 7 lines]
> Haven't checked, and I am moving to Xcode anyway so I doubt I'll take
> the time to do so :-)
Which is pretty much the same reason why I haven't checked. :) But
libgmalloc and Malloc Debug were changed to work better in cases like
this for Tiger, so I wouldn't be surprised if it's fixed.
-Eric

Signature
Eric Albert ejalbert@cs.stanford.edu
http://outofcheese.org/