[Asterisk-code-review] RFC: ao2 reference storage location logging. (asterisk[master])

Corey Farrell asteriskteam at digium.com
Thu Jul 7 19:49:46 CDT 2016


Corey Farrell has posted comments on this change.

Change subject: RFC: ao2 reference storage location logging.
......................................................................


Patch Set 2:

> Tracking addresses of where refs are stored is going to be fragile
 > for all but the simplest cases.  This method would not be able to
 > track implicit reference transfers to a called function.  For
 > example, passing a reference to a task processor callback.  This
 > method would not be able to track references placed into a vector
 > that then has the members shifted to keep the member order (i.e.,
 > sorted vector members).

I've published updated code that addresses most this.  Any number of references can use the same debugstorage location at the same time, and debugstorage doesn't actually have to point to the location that is storing a reference.  For vectors you would just use the address of the vector itself as debugstorage for adding/removing item references.  For ao2_containers use of the container is automatic.

For situations where a reference is being returned to an unknown address you can use NULL for the debugstorage location if it's not worth it to accept 'void *debugstorage' from the caller.

 > Taking the address of a variable guarantees that it cannot be
 > stored in a register.  Granted it won't matter in most cases and
 > CISC processors have so few registers anyway.

In many cases we will be taking the address of a member field, &myobj->member.  It's not required to use the variable address in all cases.

 > It might be better to make refcounter.py able to process multi
 > gigabyte files without choking.  One way would be to preprocess the
 > ref log file by sorting the lines into temporary files that are
 > then processed separately.  i.e., break the job into smaller
 > pieces.

I've never had refcounter.py choke on a large input file, that's a separate issue.  The goal of this is to make the output of refcounter.py smaller (the stuff read by humans hunting for leaks).

-- 
To view, visit https://gerrit.asterisk.org/3141
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: Iacb0a51cefaa98c83eab18aa2b7d18850bb33951
Gerrit-PatchSet: 2
Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-Owner: Corey Farrell <git at cfware.com>
Gerrit-Reviewer: Anonymous Coward #1000019
Gerrit-Reviewer: Corey Farrell <git at cfware.com>
Gerrit-Reviewer: Matt Jordan <mjordan at digium.com>
Gerrit-Reviewer: Richard Mudgett <rmudgett at digium.com>
Gerrit-HasComments: No



More information about the asterisk-code-review mailing list