Branch: refs/heads/3.3 Home: https://github.com/OpenSIPS/opensips Commit: 14bb9dcb10ec4f2661ec0c71ab03ff6f35dcbc84 https://github.com/OpenSIPS/opensips/commit/14bb9dcb10ec4f2661ec0c71ab03ff6f35dcbc84 Author: Liviu Chircu <li...@opensips.org> Date: 2023-04-19 (Wed, 19 Apr 2023)
Changed paths: M mem/f_malloc.c M mem/f_malloc.h M mem/f_malloc_dyn.h Log Message: ----------- F_MALLOC: Add LHS coalescing on free() operations This is a continuation/rework of commit fb9a3777, which intended to address the de-fragmentation issues where performance would drop. Unfortunately, there were still memory allocation / releasing patterns which still lead to heavy fragmentation. For example, an MI "dlg_list" command, which allocates fragments from Left -> Right as the dialog list is walked: Chunk-1 Chunk-2 Chunk-3 ... Chunk-N After building the MI output, the chunks were also freed Left -> Right. Due to the former allocator logic of RHS-only coalescing, the coalescing would never happen! In some cases, this could lead to fragmentation of an indefinite amount of memory, given enough time (e.g., even 8 GB PKG). This patch adds LHS coalescing to F_MALLOC, such that when "Chunk-2" is freed, in the above example, the allocator tries to merge it with both "Chunk-1" and "Chunk-3" before exiting the free() function (depending on the state of chunks 1 and 3, this could mean 0, 1 or 2 coalescings). This F_MALLOC patch was stress-tested using the mem/test/ testing suite. Many thanks to @fedkis and @ankogan for helping troubleshoot the issue and also test the current version of this patch! Fixes #2726 (cherry picked from commit bdaaf60b2c42681da70f095468c2df1b8dfa8c3e) _______________________________________________ Devel mailing list Devel@lists.opensips.org http://lists.opensips.org/cgi-bin/mailman/listinfo/devel