Skip to contentSkip to conversation

malloc: Show amount of used space when memory runs out

PATCH New Simon Glass 1 participant 1 message Sep 21, 2024

lore
Share & tools
lore
#0 lore raw

PATCH v3 5/18 malloc: Show amount of used space when memory runs out

Show a bit more information when malloc() space is exhausted and debugging is not enabled.

---

Changes in v3:
- Add the missing word 'not' into the commit message

Changes in v2:
- Add field names into the message

 common/malloc_simple.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
common/malloc_simple.c +2 -1
index 5a8ec538f8f..f0f90a095bd 100644
@@ -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 ptr %lx limit %x\n", new_ptr,
+			gd->malloc_limit);
 		return NULL;
 	}
 
Signature · 1 line
2.43.0