refcounter.py: prevent use of excessive RAM with large refs logs

When processing a 212MB refs file, refcounter.py used over 3GB of RAM.
This change greatly reduces memory usage in two ways:

* Saving object history in whole lines instead of separated values.
* Not saving normal/skewed/leaked object lists unless they are requested.

ASTERISK-23921 #close
Reported by: Corey Farrell
Review: https://reviewboard.asterisk.org/r/3668/


git-svn-id: http://svn.asterisk.org/svn/asterisk/branches/1.8@417480 f38db490-d61c-443f-a65b-d21fe96a405b
Ensure REF_DEBUG records entrys for attempts to ao2_ref an invalid object

This change ensures that __ao2_ref_debug writes to ref_log when given a
non-NULL pointer to an invalid ao2 object.  This is to ensure that we
record any attempt manipulate references of already freed objects.

ASTERISK-23948 #close
Reported by: Corey Farrell
Review: https://reviewboard.asterisk.org/r/3677/


git-svn-id: http://svn.asterisk.org/svn/asterisk/branches/1.8@417500 f38db490-d61c-443f-a65b-d21fe96a405b