[PATCH 06/19] malloc: Show amount of used space when memory runs out

Tom Rini trini at konsulko.com
Thu Aug 29 19:26:26 CEST 2024


On Thu, Aug 29, 2024 at 08:57:49AM -0600, Simon Glass wrote:
> Show a bit more information when malloc() space is exhausted and
> debugging is enabled.
> 
> Signed-off-by: Simon Glass <sjg at chromium.org>
> ---
> 
>  common/malloc_simple.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/common/malloc_simple.c b/common/malloc_simple.c
> index 5a8ec538f8f..f2b3dc53689 100644
> --- a/common/malloc_simple.c
> +++ b/common/malloc_simple.c
> @@ -26,7 +26,8 @@ static void *alloc_simple(size_t bytes, int align)
>  	log_debug("size=%lx, ptr=%lx, limit=%x: ", (ulong)bytes, new_ptr,
>  		  gd->malloc_limit);
>  	if (new_ptr > gd->malloc_limit) {
> -		log_err("alloc space exhausted\n");
> +		log_err("alloc space exhausted %lx %x\n", new_ptr,
> +			gd->malloc_limit);
>  		return NULL;
>  	}

Since debugging is enabled you should update the error message to say
what the values mean...

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20240829/0f1c8eaa/attachment.sig>


More information about the U-Boot mailing list