dect
/
asterisk
Archived
13
0
Fork 0
Commit Graph

6 Commits

Author SHA1 Message Date
tilghman 7aea5fb849 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: http://svn.digium.com/svn/asterisk/trunk@304951 f38db490-d61c-443f-a65b-d21fe96a405b
2011-01-31 06:50:49 +00:00
russell f8f4f299a4 Fix handling of removing nodes from the middle of a heap.
This bug surfaced in 1.6.2 and does not affect code in any other released
version of Asterisk.  It manifested itself as SIP qualify not happening when
it should, causing peers to go unreachable.  This was debugged down to scheduler
entries sometimes not getting executed when they were supposed to, which was in
turn caused by an error in the heap code.

The problem only sometimes occurs, and it is due to the logic for removing an entry
in the heap from an arbitrary location (not just popping off the top).  The scheduler
performs this operation frequently when entries are removed before they run (when
ast_sched_del() is used).

In a normal pop off of the top of the heap, a node is taken off the bottom,
placed at the top, and then bubbled down until the max heap property is restored
(see max_heapify()).  This same logic was used for removing an arbitrary node
from the middle of the heap.  Unfortunately, that logic is full of fail.  This
patch fixes that by fully restoring the max heap property when a node is thrown
into the middle of the heap.  Instead of just pushing it down as appropriate, it
first pushes it up as high as it will go, and _then_ pushes it down.

Lastly, fix a minor problem in ast_heap_verify(), which is only used for
debugging.  If a parent and child node have the same value, that is not an
error.  The only error is if a parent's value is less than its children.

A huge thanks goes out to cappucinoking for debugging this down to the scheduler,
and then producing an ast_heap test case that demonstrated the breakage.  That
made it very easy for me to focus on the heap logic and produce a fix.  Open source
projects are awesome.

(closes issue #16936)
Reported by: ib2
Tested by: cappucinoking, crjw

(closes issue #17277)
Reported by: cappucinoking
Patches:
      heap-fix.rev2.diff uploaded by russell (license 2)
Tested by: cappucinoking, russell


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@261496 f38db490-d61c-443f-a65b-d21fe96a405b
2010-05-06 13:58:07 +00:00
qwell 8d07966e39 Remove ABI differences that occured when compiling with DEBUG_THREADS.
"Bad Things" would happen if Asterisk was compiled with DEBUG_THREADS, but a
loaded module was not (or vice versa).  This also immensely simplifies the
lock code, since there are no longer 2 separate versions of them.

Review: https://reviewboard.asterisk.org/r/508/


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@258557 f38db490-d61c-443f-a65b-d21fe96a405b
2010-04-22 19:08:01 +00:00
russell d8dbfb1cb1 Pass more useful information through to lock tracking when DEBUG_THREADS is on.
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@184512 f38db490-d61c-443f-a65b-d21fe96a405b
2009-03-27 01:35:56 +00:00
tilghman a914fe0511 Add MALLOC_DEBUG to various utility APIs, so that memory leaks can be tracked back to their source.
(related to issue #14636)


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@181028 f38db490-d61c-443f-a65b-d21fe96a405b
2009-03-11 00:29:59 +00:00
russell 18f52ab1e7 Add an implementation of the heap data structure.
A heap is a convenient data structure for implementing a priority queue.

Code from svn/asterisk/team/russell/heap/.

Review: http://reviewboard.digium.com/r/160/


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@176632 f38db490-d61c-443f-a65b-d21fe96a405b
2009-02-17 20:51:10 +00:00