malloc: Add 'malloc' command with 'info' subcommand
Add a command to display malloc heap statistics, showing total heap size and memory currently in use. Co-developed-by: Claude <noreply@anthropic.com> Signed-off-by: Simon Glass <simon.glass@canonical.com>
This commit is contained in:
45
doc/usage/cmd/malloc.rst
Normal file
45
doc/usage/cmd/malloc.rst
Normal file
@@ -0,0 +1,45 @@
|
||||
.. SPDX-License-Identifier: GPL-2.0+:
|
||||
|
||||
.. index::
|
||||
single: malloc (command)
|
||||
|
||||
malloc command
|
||||
==============
|
||||
|
||||
Synopsis
|
||||
--------
|
||||
|
||||
::
|
||||
|
||||
malloc info
|
||||
|
||||
Description
|
||||
-----------
|
||||
|
||||
The malloc command shows information about the malloc heap.
|
||||
|
||||
info
|
||||
Shows memory-allocation statistics, including the total heap size and the
|
||||
amount currently in use.
|
||||
|
||||
The total heap size is set by ``CONFIG_SYS_MALLOC_LEN``.
|
||||
|
||||
Example
|
||||
-------
|
||||
|
||||
::
|
||||
|
||||
=> malloc info
|
||||
total bytes = 96 MiB
|
||||
in use bytes = 700.9 KiB
|
||||
|
||||
Configuration
|
||||
-------------
|
||||
|
||||
The malloc command is enabled by CONFIG_CMD_MALLOC which depends on
|
||||
CONFIG_MALLOC_DEBUG.
|
||||
|
||||
Return value
|
||||
------------
|
||||
|
||||
The return value $? is 0 (true) on success, 1 (false) on failure.
|
||||
@@ -97,6 +97,7 @@ Shell commands
|
||||
cmd/loadx
|
||||
cmd/loady
|
||||
cmd/luks
|
||||
cmd/malloc
|
||||
cmd/meminfo
|
||||
cmd/mbr
|
||||
cmd/md
|
||||
|
||||
Reference in New Issue
Block a user