Skip to content

Commit

Permalink
increase the size of the buffer by a factor of 1.5
Browse files Browse the repository at this point in the history
Which is more cache and memory manager friendly.

Reference: https://github.com/facebook/folly/blob/main/folly/docs/FBVector.md#memory-handling
  • Loading branch information
jmillan committed Jan 17, 2024
1 parent 1515b76 commit 16ae11e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions srtp/srtp.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 16ae11e

Please sign in to comment.