From 16ae11e56e7177f321157cdd698bb92f49325eeb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Luis=20Mill=C3=A1n?= Date: Wed, 17 Jan 2024 13:56:54 +0100 Subject: [PATCH] increase the size of the buffer by a factor of 1.5 Which is more cache and memory manager friendly. Reference: https://github.com/facebook/folly/blob/main/folly/docs/FBVector.md#memory-handling --- srtp/srtp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/srtp/srtp.c b/srtp/srtp.c index 0b91add04..291dcbb94 100644 --- a/srtp/srtp.c +++ b/srtp/srtp.c @@ -4906,10 +4906,10 @@ srtp_err_status_t srtp_stream_list_insert(srtp_stream_list_t list, { /* * there is no space to hold the new entry in the entries buffer, - * double the size of the buffer. + * increase the size of the buffer by a factor of 1.5. */ if (list->size == list->capacity) { - size_t new_capacity = list->capacity * 2; + size_t new_capacity = list->capacity + ((list->capacity + 1u) / 2u); list_entry *new_entries = srtp_crypto_alloc(sizeof(list_entry) * new_capacity); if (new_entries == NULL) {