Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-devel / 2011-05

How to clearly shutdown ThreadManager

1 message · 1 person ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Petr Kristan

Hi.

If I check my multithreaded program with valgrind in linux I get these memoryleaks:

==27262== 32 bytes in 1 blocks are still reachable in loss record 1 of 2 ==27262== at 0x4C27480: calloc (vg_replace_malloc.c:467) ==27262== by 0x504C31F: _dlerror_run (dlerror.c:142) ==27262== by 0x504BEE0: dlopen@@GLIBC_2.2.5 (dlopen.c:88) ==27262== by 0x43E368: CTHREADS_LOADPTHREADS$$BOOLEAN (pthread.inc:261) ==27262== by 0x43FC38: CTHREADS_CINITTHREADS$$BOOLEAN (cthreads.pp:960) ==27262== by 0x4324D0: SYSTEM_SETTHREADMANAGER$TTHREADMANAGER$$BOOLEAN (thread.inc:241) ==27262== by 0x43FF96: CTHREADS_SETCTHREADMANAGER (cthreads.pp:1025) ==27262== by 0x440023: CTHREADS_init (cthreads.pp:1036) ==27262== by 0x42E8FE: fpc_initializeunits (system.inc:794) ==27262== by 0x417F16: main (xmlrpcserver.dpr:21) ==27262==
==27262== 56 bytes in 1 blocks are still reachable in loss record 2 of 2 ==27262== at 0x4C2815C: malloc (vg_replace_malloc.c:236) ==27262== by 0x400D624: _dl_map_object_deps (dl-deps.c:506) ==27262== by 0x4013964: dl_open_worker (dl-open.c:263) ==27262== by 0x400ED35: _dl_catch_error (dl-error.c:178) ==27262== by 0x4013329: _dl_open (dl-open.c:555) ==27262== by 0x504BF65: dlopen_doit (dlopen.c:67) ==27262== by 0x400ED35: _dl_catch_error (dl-error.c:178) ==27262== by 0x504C2AB: _dlerror_run (dlerror.c:164) ==27262== by 0x504BEE0: dlopen@@GLIBC_2.2.5 (dlopen.c:88) ==27262== by 0x43E368: CTHREADS_LOADPTHREADS$$BOOLEAN (pthread.inc:261) ==27262== by 0x43FC38: CTHREADS_CINITTHREADS$$BOOLEAN (cthreads.pp:960) ==27262== by 0x4324D0: SYSTEM_SETTHREADMANAGER$TTHREADMANAGER$$BOOLEAN (thread.inc:241) ==27262== by 0x43FF96: CTHREADS_SETCTHREADMANAGER (cthreads.pp:1025) ==27262== by 0x440023: CTHREADS_init (cthreads.pp:1036) ==27262== by 0x42E8FE: fpc_initializeunits (system.inc:794) ==27262== by 0x417F16: main (xmlrpcserver.dpr:21)

IMHO it is because CThreadManager.DoneManager (calls UnLoadPthreads) is not called at the end of program.

Is any way how to shutdown threading and satisfy valgrind by dlclose()?

Thanks
Petr

Petr Kristan . EPOS PRO s.r.o., Bozeny Nemcove 2625, 530 02 Pardubice tel: +420 466335223 Czech Republic (Eastern Europe) fax: +420 466510709

Reply by email