[SOLVED] still reachable: 28 bytes in 1 blocks
Hi all
I am using valgrind 3.6.0 for finding memory leak in my application.
this is the application
Code:
#include <unistd.h>
#include <pthread.h>
void *start_routine(void *arg)
{
sleep(60);
return 0;
}
int main()
{
pthread_attr_t attr;
pthread_t th;
pthread_attr_init(&attr);
pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
pthread_create(&th, &attr, start_routine, NULL);
pthread_attr_destroy(&attr);
sleep(1);
pthread_cancel(th);
return 0;
}
I am getting the following error.
Code:
==22589== HEAP SUMMARY:
==22589== in use at exit: 28 bytes in 1 blocks
==22589== total heap usage: 3 allocs, 2 frees, 524 bytes allocated
==22589==
==22589== 28 bytes in 1 blocks are still reachable in loss record 1 of 1
==22589== at 0x4023CBE: malloc (vg_replace_malloc.c:236)
==22589== by 0x400CE43: _dl_map_object_deps (in /lib/ld-2.5.so)
==22589== by 0x4011E34: dl_open_worker (in /lib/ld-2.5.so)
==22589== by 0x400E025: _dl_catch_error (in /lib/ld-2.5.so)
==22589== by 0x4011928: _dl_open (in /lib/ld-2.5.so)
==22589== by 0x4449F01: do_dlopen (in /lib/libc-2.5.so)
==22589== by 0x400E025: _dl_catch_error (in /lib/ld-2.5.so)
==22589== by 0x444A000: dlerror_run (in /lib/libc-2.5.so)
==22589== by 0x444A12A: __libc_dlopen_mode (in /lib/libc-2.5.so)
==22589== by 0x405AE66: pthread_cancel_init (in /lib/libpthread-2.5.so)
==22589== by 0x405AF90: _Unwind_ForcedUnwind (in /lib/libpthread-2.5.so)
==22589== by 0x4058950: __pthread_unwind (in /lib/libpthread-2.5.so)
==22589==
==22589== LEAK SUMMARY:
==22589== definitely lost: 0 bytes in 0 blocks
==22589== indirectly lost: 0 bytes in 0 blocks
==22589== possibly lost: 0 bytes in 0 blocks
==22589== still reachable: 28 bytes in 1 blocks
==22589== suppressed: 0 bytes in 0 blocks
==22589==
==22589== For counts of detected and suppressed errors, rerun with: -v
==22589== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 3 from 3)
emmys0126:/opt/mdas # valgrind --tool=memcheck --leak-check=full --show-reachable=yes ./mdas-pc
==24173== Memcheck, a memory error detector
==24173== Copyright (C) 2002-2010, and GNU GPL'd, by Julian Seward et al.
==24173== Using Valgrind-3.6.0 and LibVEX; rerun with -h for copyright info
==24173== Command: ./mdas-pc
Please help me to find out where the 28 bytes leaks ?
Regards
SJR