PRE-2016 Valgrind: Still Reachable Leak detected by Valgrind

There is more than one way to define “memory leak”. In particular, there are two primary definitions of “memory leak” that are in common usage among programmers. The first commonly used definition of “memory leak” is, “Memory was allocated and was not subsequently freed before the program terminated.” However, many programmers (rightly) argue that certain … Read more

Should I use Helgrind or DRD for thread error detection?

While Helgrind can detect locking order violations, for most programs DRD needs less memory to perform its analysis. Also, DRD has support for detached threads. There are more subtle differences too – compare the respective manuals if you want to know more. See also http://valgrind.org/docs/manual/hg-manual.html and http://valgrind.org/docs/manual/drd-manual.html.

When to use pthread condition variables?

Condition variables should be used as a place to wait and be notified. They are not the condition itself and they are not events. The condition is contained in the surrounding programming logic. The typical usage pattern of condition variables is // safely examine the condition, prevent other threads from // altering it pthread_mutex_lock (&lock); … Read more

valgrind memory leak errors when using pthread_create

A thread’s resources are not immediately released at termination, unless the thread was created with the detach state attribute set to PTHREAD_CREATE_DETACHED, or if pthread_detach is called for its pthread_t. An undetached thread will remain terminated state until its identifier is passed to pthread_join or pthread_detach. To sum it up, you have three options: create … Read more

What is PTHREAD_MUTEX_ADAPTIVE_NP

PTHREAD_MUTEX_ADAPTIVE_NP is something that I invented1 while working in the role of a glibc contributor on making LinuxThreads more reliable and perform better. LinuxThreads was the predecessor to glibc’s NPTL library, originally developed as a stand-alone library by Xavier Leroy, who is also well-known as one of the creators of OCaml. The adaptive mutex survived … Read more

techhipbettruvabetnorabahisbahis forumuedusedueduedueduseduseduseduseduedus