| 131 | == Debugging == |
| 132 | |
| 133 | To enable debugging, declare {{{PJ_GRP_LOCK_DEBUG}}} to non-zero in your {{{config_site.h}}}. With this, now every call to {{{pj_grp_lock_dec_ref()}}} will cause the group lock state to be printed to log at level four. This info includes the current value of the reference counter, along with the source file and line number info of the code that adds the reference counter. |
| 134 | |
| 135 | Note though that each {{{pj_grp_lock_acquire()}}} and {{{pj_grp_lock_release()}}} also increments and decrements the reference counter, hence they will also cause info to be dump. |
| 136 | |
| 137 | If you after this find out that the leaking reference is caused by timer, you can enable timer heap debugging by setting {{{PJ_TIMER_DEBUG}}} to non-zero and call {{{pj_timer_heap_dump()}}} to dump the state of the timer heap including information about the source file and line number of code that registered currently active timer entries. |
| 138 | |