| 130 | == Important Issue(s) when Developing Apps with Pjsua2 API == #issues |
| 131 | |
| 132 | === Garbage Collector May Crash Your App === #gc |
| 133 | |
| 134 | There are two problems with Java garbage collector (gc): |
| 135 | - it delays the destruction of Java objects (including pjsua2 objects), causing the code in object's destructor to be executed out of order |
| 136 | - the gc operation may be run on different thread, not previously registered to PJLIB |
| 137 | |
| 138 | Due to problems above, '''application MUST immediately destroy pjsua2 objects using object's delete() method''', instead of relying on the gc to clean up the object. |
| 139 | |
| 140 | For example, to delete an Account: |
| 141 | |
| 142 | {{{ |
| 143 | acc.delete(); |
| 144 | }}} |
| 145 | |
| 146 | |
| 147 | |