From 16c3ea3d42370e676efb2e145675e4b053c318fc Mon Sep 17 00:00:00 2001 From: Tilghman Lesher Date: Mon, 31 Jan 2011 06:50:49 +0000 Subject: Merged revisions 304950 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.8 ........ r304950 | tilghman | 2011-01-31 00:41:36 -0600 (Mon, 31 Jan 2011) | 18 lines Change mutex tracking so that it only consumes memory in the core mutex object when it's actually being used. This reduces the overall size of a mutex which was 3016 bytes before this back down to 216 bytes (this is on 64-bit Linux with a glibc-implemented mutex). The exactness of the numbers here may vary slightly based upon how mutexes are implemented on a platform, but the long and short of it is that prior to this commit, chan_iax2 held down 98MB of memory on a 64-bit system for nothing more than a table of 32767 locks. After this commit, the same table occupies a mere 7MB of memory. (closes issue #18194) Reported by: job Patches: 20110124__issue18194.diff.txt uploaded by tilghman (license 14) Tested by: tilghman Review: https://reviewboard.asterisk.org/r/1066 ........ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@304951 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- main/heap.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'main/heap.c') diff --git a/main/heap.c b/main/heap.c index 929965f5f..9c4379aba 100644 --- a/main/heap.c +++ b/main/heap.c @@ -308,15 +308,15 @@ size_t ast_heap_size(struct ast_heap *h) int __ast_heap_wrlock(struct ast_heap *h, const char *file, const char *func, int line) { - return __ast_rwlock_wrlock(&h->lock, "&h->lock", file, line, func); + return __ast_rwlock_wrlock(file, line, func, &h->lock, "&h->lock"); } int __ast_heap_rdlock(struct ast_heap *h, const char *file, const char *func, int line) { - return __ast_rwlock_rdlock(&h->lock, "&h->lock", file, line, func); + return __ast_rwlock_rdlock(file, line, func, &h->lock, "&h->lock"); } int __ast_heap_unlock(struct ast_heap *h, const char *file, const char *func, int line) { - return __ast_rwlock_unlock(&h->lock, "&h->lock", file, line, func); + return __ast_rwlock_unlock(file, line, func, &h->lock, "&h->lock"); } -- cgit v1.2.3