[so] [Tema 4][Linux] Elemente de sincronizare && leaks
Darius-Florentin Neatu
neatudarius at gmail.com
Tue May 9 06:11:06 EEST 2017
Salut,
1. In restrictia
"Tema se va rezolva folosind fire de execuție POSIX și exclusiv mecanisme
de sincronizare a firelor de execuție POSIX (mutex, variabile de
condiție).",
termenul general de mutex include atat pthread_mutex_t cat si sem_t?
("Semafoarele
sunt obiecte de sincronizare ce reprezintă o generalizare a mutex-urilor")
Vreau doar sa ma asigur ca este ok daca am folosit si sem_t.
2. Am verificat daca am memory leaks ruland valgrind:
valgrind --leak-check=full --show-leak-kinds=all ./_test/run_test $i
Aparent nu am memory leaks, dar o data la foarte multe rulari pe testul 16
am un block "possibly lost". Din cate inteleg, problema este din
pthread_create (poate SO-ul elibereaza niste resurse mai tarziu - stiu ca
asta se intampla cu unele implementari pentru biblioteca <iostream> din
C++; m-am gandit ca este o situatie asemanatoare).
Mentionez ca am creat threadurile cu atributul PTHREAD_CREATE_DETACHED.
Tema este pe GitLab[1].
As vrea sa stiu daca se depuncteaza pentru aceasta eroare.
==11340==
==11340== HEAP SUMMARY:
==11340== in use at exit: 272 bytes in 1 blocks
==11340== total heap usage: 2,712 allocs, 2,711 frees, 199,920 bytes
allocated
==11340==
==11340== 272 bytes in 1 blocks are possibly lost in loss record 1 of 1
==11340== at 0x4C2FB55: calloc (in
/usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==11340== by 0x40136D4: allocate_dtv (dl-tls.c:322)
==11340== by 0x40136D4: _dl_allocate_tls (dl-tls.c:539)
==11340== by 0x504826E: allocate_stack (allocatestack.c:588)
==11340== by 0x504826E: pthread_create@@GLIBC_2.2.5
(pthread_create.c:539)
==11340== by 0x4E3D585: thread_init (helpers.c:25)
==11340== by 0x4E3C791: so_fork (so_scheduler.c:73)
==11340== by 0x4021F9: test_sched_handler_16 (test_exec.c:364)
==11340== by 0x4E3CDD8: start_thread (so_scheduler.c:192)
==11340== by 0x50476B9: start_thread (pthread_create.c:333)
==11340==
==11340== LEAK SUMMARY:
==11340== definitely lost: 0 bytes in 0 blocks
==11340== indirectly lost: 0 bytes in 0 blocks
==11340== possibly lost: 272 bytes in 1 blocks
==11340== still reachable: 0 bytes in 0 blocks
==11340== suppressed: 0 bytes in 0 blocks
==11340==
==11340== For counts of detected and suppressed errors, rerun with: -v
==11340== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0)
Darius
[1] https://gitlab.cs.pub.ro/darius.neatu1995/SO
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://cursuri.cs.pub.ro/pipermail/so/attachments/20170509/638fe446/attachment.html>
More information about the so
mailing list