diff mbox series

[v5,1/7] malloc: replace _int_free by _int_free_chunk in sysmalloc.

Message ID 20250321120102.54012-2-cupertino.miranda@oracle.com
State New
Headers show
Series tcache: malloc improvements | expand

Commit Message

Cupertino Miranda March 21, 2025, noon UTC
sysmalloc calls to _int_free should not allow the freed chunks to be
taken by tcache. These internal calls to free do not reflect any of the
needs of the application, but rather chunk management.
This code replaces those calls to _int_free by calls to _int_free_chunk.
---
 malloc/malloc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/malloc/malloc.c b/malloc/malloc.c
index b73ddbf554..59b22b3455 100644
--- a/malloc/malloc.c
+++ b/malloc/malloc.c
@@ -2646,7 +2646,7 @@  sysmalloc (INTERNAL_SIZE_T nb, mstate av)
 			CHUNK_HDR_SZ | PREV_INUSE);
               set_foot (chunk_at_offset (old_top, old_size), CHUNK_HDR_SZ);
               set_head (old_top, old_size | PREV_INUSE | NON_MAIN_ARENA);
-              _int_free (av, old_top, 1);
+	      _int_free_chunk (av, old_top, chunksize (old_top), 1);
             }
           else
             {
@@ -2912,7 +2912,7 @@  sysmalloc (INTERNAL_SIZE_T nb, mstate av)
                       /* If possible, release the rest. */
                       if (old_size >= MINSIZE)
                         {
-                          _int_free (av, old_top, 1);
+			  _int_free_chunk (av, old_top, chunksize (old_top), 1);
                         }
                     }
                 }