Add mallocinfo mode to getmemoryinfo RPC
Summary:
This adds a mode argument to getmemoryinfo. By default the output
will remain the same. However if a mode argument of mallocinfo is
provided the result of glibc malloc_info (if available) will
be returned as a string, as-is.
This is useful for tracking heap usage over time or troubleshooting
memory fragmentation issues.
This is a backport of Core PR10038
Test Plan:
make check ninja all check
Reviewers: #bitcoin_abc, schancel
Reviewed By: #bitcoin_abc, schancel
Subscribers: teamcity
Differential Revision: https://reviews.bitcoinabc.org/D1899