This is the mail archive of the glibc-bugs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug malloc/24026] New: malloc_info() returns wrong numbers


https://sourceware.org/bugzilla/show_bug.cgi?id=24026

            Bug ID: 24026
           Summary: malloc_info() returns wrong numbers
           Product: glibc
           Version: 2.23
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: malloc
          Assignee: unassigned at sourceware dot org
          Reporter: mail at nh2 dot me
  Target Milestone: ---

Created attachment 11487
  --> https://sourceware.org/bugzilla/attachment.cgi?id=11487&action=edit
Patch fixing missing accounting of top chunk

glibc's malloc_info() function returns wrong numbers in most of the cases.

In particular, the `rest` field is 0 most of the time, and inconsistent with
malloc_stats().

I believe this bug was introduced in commit

    commit bb066545063246d6df186f5a5a61303c58c6547d
    Author: Ulrich Drepper <drepper@redhat.com>
    Date:   Thu Apr 9 05:45:42 2009 +0000

        * malloc/malloc.c (malloc_info): New function.

when the implementation of malloc_info() was copy-pasted from mallinfo(), and
that the two mallinfo() lines

+      avail = chunksize (ar_ptr->top);
+      nblocks = 1;  /* top always exists */

were forgotten to be copy-pasted.

I have attached a patch that fixes the issue.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]