Ticket #877: Memory consumption of the invite session grows indefinitely if call is running for long period of time and with many re-INVITES
- introducing flip-flop pools in the pjsip_inv_session. There are two additional pools created, and one of them will be reset everytime SDP negotiation is done to release memory back to the OS
git-svn-id: https://svn.pjsip.org/repos/pjproject/trunk@2869 74dad513-b988-da41-8d7b-12977e46ad98
diff --git a/pjsip/src/pjsua-lib/pjsua_call.c b/pjsip/src/pjsua-lib/pjsua_call.c
index e244aec..5c493d0 100644
--- a/pjsip/src/pjsua-lib/pjsua_call.c
+++ b/pjsip/src/pjsua-lib/pjsua_call.c
@@ -1596,7 +1596,8 @@
if (call->local_hold && !unhold) {
status = create_sdp_of_call_hold(call, &sdp);
} else {
- status = pjsua_media_channel_create_sdp(call->index, call->inv->pool,
+ status = pjsua_media_channel_create_sdp(call->index,
+ call->inv->pool_prov,
NULL, &sdp, NULL);
call->local_hold = PJ_FALSE;
}
@@ -1655,7 +1656,8 @@
return status;
/* Create SDP */
- status = pjsua_media_channel_create_sdp(call->index, call->inv->pool,
+ status = pjsua_media_channel_create_sdp(call->index,
+ call->inv->pool_prov,
NULL, &sdp, NULL);
if (status != PJ_SUCCESS) {
pjsua_perror(THIS_FILE, "Unable to get SDP from media endpoint",
@@ -3200,8 +3202,8 @@
pj_pool_t *pool;
pjmedia_sdp_session *sdp;
- /* Use call's pool */
- pool = call->inv->pool;
+ /* Use call's provisional pool */
+ pool = call->inv->pool_prov;
/* Create new offer */
status = pjsua_media_channel_create_sdp(call->index, pool, NULL, &sdp,
@@ -3267,7 +3269,8 @@
PJ_LOG(4,(THIS_FILE, "Call %d: received updated media offer",
call->index));
- status = pjsua_media_channel_create_sdp(call->index, call->inv->pool,
+ status = pjsua_media_channel_create_sdp(call->index,
+ call->inv->pool_prov,
offer, &answer, NULL);
if (status != PJ_SUCCESS) {
pjsua_perror(THIS_FILE, "Unable to create local SDP", status);
@@ -3296,7 +3299,7 @@
/* Keep call on-hold by setting 'sendonly' attribute.
* (See RFC 3264 Section 8.4 and RFC 4317 Section 3.1)
*/
- attr = pjmedia_sdp_attr_create(call->inv->pool, "sendonly", NULL);
+ attr = pjmedia_sdp_attr_create(call->inv->pool_prov, "sendonly", NULL);
pjmedia_sdp_media_add_attr(answer->media[0], attr);
}
@@ -3334,7 +3337,8 @@
PJ_LOG(4,(THIS_FILE, "Call %d: asked to send a new offer",
call->index));
- status = pjsua_media_channel_create_sdp(call->index, call->inv->pool,
+ status = pjsua_media_channel_create_sdp(call->index,
+ call->inv->pool_prov,
NULL, offer, NULL);
}