Bug 32181 - malloc_info should be documented
Summary: malloc_info should be documented
Status: UNCONFIRMED
Alias: None
Product: glibc
Classification: Unclassified
Component: manual (show other bugs)
Version: 2.41
: P2 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-09-16 21:53 UTC by Samuel Bronson
Modified: 2024-09-16 21:53 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Samuel Bronson 2024-09-16 21:53:16 UTC
It would be good if malloc_info was mentioned in the manual, because:

  1. I have wasted entirely too much time wondering if it was deliberately omitted or simply forgotten. (My conclusion: if you wanted people to avoid using it, you would just say so explicitly rather than removing it.)

  2. It would be nice to see some official guidance on format stability, when to use/avoid it, etc.

  3. Bionic says:

```c
#ifndef STRUCT_MALLINFO_DECLARED
#define STRUCT_MALLINFO_DECLARED 1
struct mallinfo { __MALLINFO_BODY };
#endif

/**
 * [mallinfo(3)](http://man7.org/linux/man-pages/man3/mallinfo.3.html) returns
 * information about the current state of the heap. Note that mallinfo() is
 * inherently unreliable and consider using malloc_info() instead.
 */
struct mallinfo mallinfo(void);

/**
 * On Android the struct mallinfo and struct mallinfo2 are the same.
 */
struct mallinfo2 { __MALLINFO_BODY };

/**
 * [mallinfo2(3)](http://man7.org/linux/man-pages/man3/mallinfo2.3.html) returns
 * information about the current state of the heap. Note that mallinfo2() is
 * inherently unreliable and consider using malloc_info() instead.
 */
struct mallinfo2 mallinfo2(void) __RENAME(mallinfo);
```

and I was hoping the glibc manual would offer another perspective ("inherently unreliable" seems ... a tad strong).