Customizing threads handling

Threads are separate, independent execution sequences within a single process. They share the same address space but maintain separate execution stacks.

By default, Purify displays a thread-summary message if your program is linked to a supported thread package. Purify displays the thread summary message after the memory leak summary.

For a list of supported thread packages, see the README file in the purifyhome directory.

Purify tracks all the threads that are created during the execution of the program. The thread summary message contains a description of each thread including its thread id, name, and stack limits.

For example:

Thread Summary: 6 threads in existence
     Thread 1
     Stack: (0xef106ad8 0xef106dcc), size = 0x2f4
     Thread 2
     Stack: (0xef7b11f8 0xef7b143c), size = 0x244
     Thread 3
     Stack: (0xef005728 0xef005dcc), size = 0x6a4
     Thread 4
     Stack: (0xef207ac8 0xef207d6c), size = 0x2a4
     Thread 5 "Producer"
     Stack: (0xeee03410 0xeee03d6c), size = 0x95c
     Thread 6 "Consumer"
     Stack: (0xeef04498 0xeef04d6c), size = 0x8d4

Purify assigns each thread an id in order to keep track of running threads. The Purify thread id is unrelated to any id defined by the thread library.

You can specify a name for Purify to use in addition to the thread id by using the API function pure_name_thread.

How Purify identifies threads

On Solaris, Purify uses the stack pointer to determine the identity of a thread. When Purify notices a change to the stack pointer, it compares the new value to the stack areas of known threads. Purify assumes that a new thread has been created if the stack pointer changes by 0x1000.

You can specify how large the change to the stack pointer has to be to mark creation of a new stack by using the option -thread-stack-change.

On HP-UX, Purify keeps track of malloc and mmap blocks, and ensures that there is only one thread stack per malloc or mmap block. In this way, whenever Purify detects that the stack pointer has crossed blocks, it reports that the program has switched threads. You can, however, override this default behavior by setting the option -enable-thread-stack-change=true. Thread identification then behaves the same as on Solaris, and looking for stack changes that can be configured using -thread-stack-change.