Summary:ASTERISK-05846: [patch] Memory leakage (RSS growth)
Reporter:Konstantin Prokazoff (oryx)Labels:
Date Opened:2005-12-15 08:10:51.000-0600Date Closed:2011-06-07 14:10:20
Versions:Frequency of
Environment:Attachments:( 0) 20051219__bug6005.diff.txt
Description:There are "system" memory leakage due to different realization of (I think) threads in Linux and FreeBSD (or other OSes). In * there are numerous pthread_attr_init, pthread_mutexattr_init, pthread_create (and such funcs), but a little of pthread_attr_destroy, ... .
After 30k calls over chan_zap, * takes 2 times more RSS, than at start.
Under heave load, this cause to coredumps with backtrace like:
#2: pthread_cancel()
#1: pthread_mutex_init()
#0: ???
(I have wrote before, about pthread_attr_setstacksize() for *BSD, due to default stack of 64k, when in Linux it 2Mb - no native threads, clone() used for).
Comments:By: Tilghman Lesher (tilghman) 2005-12-15 21:05:55.000-0600

When is an attr object free to destroy on FreeBSD:  after a pthread_create, or only after the related thread has been joined or cancelled?

By: Konstantin Prokazoff (oryx) 2005-12-19 07:22:51.000-0600

attr object may be freed after thread creation. same with mutexes too, but I think great scheme w'be to use single objects with global references to them (for example: pthread_mutexattr_t ast_pthread_mutexattr_default) and one-time init of one.

By: Tilghman Lesher (tilghman) 2005-12-19 22:43:43.000-0600

See if this patch fixes your memory leak.

By: Tilghman Lesher (tilghman) 2006-01-09 17:27:01.000-0600

Reporter lost interest