For the simple program
int
main (void)
{
bindtextdomain ("quark", "test");
return 0;
}
NJAMD reports 2 memory leaks.
NJAMD totals:
Allocation totals: 2 total, 2 leaked
Leaked User Memory: 27 bytes
Peak User Memory: 27 bytes
NJAMD Overhead at peak: 7.974 kB
Peak NJAMD Overhead: 7.974 kB
Average NJAMD Overhead: 3.986 kB per alloc
Address space used: 16.000 kB
NJAMD Overhead at exit: 7.974 kB
I discussed this with Andreas Jaeger, a GLIBC
developer, and he claims that the report is correct but
bogus, since NJAMD needs to call a cleanup function
like GLIBC's mtrace does. I quote:
"It's a communication problem between NJAMD and glibc.
glibc only frees the values it allocates if this is
explictly requested - and therefore the application has
to run the subfreeres hook. NJAMD apparently does not
do this.
If you file the bug, tell them to look at glibc's file
malloc/mtrace.c to see what's done there."
It would be nice to fix this; this and a similar "leak"
in textdomain () are the only issues NJAMD reports in
my application.
Thanks!
Neil.
Logged In: YES
user_id=296951
Another one which I find is running the code:
#include <stdio.h>
#include <time.h>
int main(int argc, char *argv[])
{
time_t t;
t = 0;
printf("Hello, world! %s\n", ctime(&t));
return 0;
}
reports
Allocation totals: 7 total, 6 leaked
Leaked User Memory: 1.257 kB
Peak User Memory: 1.565 kB
NJAMD Overhead at peak: 10.435 kB
Peak NJAMD Overhead: 22.743 kB
Average NJAMD Overhead: 3.770 kB per alloc
Address space used: 56.000 kB
NJAMD Overhead at exit: 22.743 kB
The cause is ctime() uses static memory but njamd should
not report memory leaks in this case.