Opened 15 years ago

Last modified 15 years ago

#688 closed defect

Memory leak on Solaris with pjlib's mutex (thanks Andrey Kobtsev for the fix) — at Initial Version

Reported by: bennylp Owned by: bennylp
Priority: normal Milestone: release-1.0.1
Component: pjlib Version: trunk
Keywords: Cc:
Backport to 1.x milestone: Backported:

Description

Quoting Andrey's mail:

"I investigated the tests for pjlib and increased the amount of pjlib tests to detect the problem. Because the memory leak is very small on original test suite.

It took the significant time to understand that memory leak relates to the mutex operations. So at the end I detected the problem.

The root cause is absence of pthread_mutexattr_destroy(&attr) call for initialized mutex attribute (pthread_mutexattr_t attr) in init_mutex function in os_core_unix.c. But POSIX Thread API demands it. Because it's PAIR CALL for pthread_mutexattr_init(&attr) (initialize/destroy approach). Each initialize call should be closed with destroy call for given mitex attribute variable.

So each time when pjsip mutex is created we have handle leak for mutex attribute inside OS.

We know that POSIX Thread API implementation is different on Linux & Solaris.

That's why we do not detect pjsip memory leaks under Linux. I think mutex attribute creation/destroying implementation does not use system handle needed to be destroyed."

Change History (0)

Note: See TracTickets for help on using tickets.