lwip-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lwip-users] [PATCH 2/7] lwip: report out of memory by pool name in debu


From: address@hidden
Subject: [lwip-users] [PATCH 2/7] lwip: report out of memory by pool name in debug
Date: Fri, 21 Sep 2007 02:28:43 +0000

lwip: report out of memory by pool name in debug
Mapping pool number to type takes time as pool number is config specific
---
 user/e7/comms/lwip/core/memp.c |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)

diff --git a/user/e7/comms/lwip/core/memp.c b/user/e7/comms/lwip/core/memp.c
index 0e1d794..e222f8f 100644
--- a/user/e7/comms/lwip/core/memp.c
+++ b/user/e7/comms/lwip/core/memp.c
@@ -117,6 +117,13 @@ static const u16_t memp_num[MEMP_MAX] = {
 #include "lwip/memp_std.h"
 };
 
+#if LWIP_DEBUG
+static const char *memp_desc[MEMP_MAX] = {
+#define LWIP_MEMPOOL(name,num,size,desc)  desc,
+#include "lwip/memp_std.h"
+};
+#endif
+
 static u8_t memp_memory[MEM_ALIGNMENT - 1 
 #define LWIP_MEMPOOL(name,num,size,desc) + ( (num) * (MEMP_SIZE + 
MEMP_ALIGN_SIZE(size) ) )
 #include "lwip/memp_std.h"
@@ -303,7 +310,8 @@ memp_malloc(memp_t type)
                 ((mem_ptr_t)memp % MEM_ALIGNMENT) == 0);
     memp = (struct memp*)((u8_t*)memp + MEMP_SIZE);
   } else {
-    LWIP_DEBUGF(MEMP_DEBUG | 2, ("memp_malloc: out of memory in pool 
%"S16_F"\n", type));
+    LWIP_DEBUGF(MEMP_DEBUG | 2, ("memp_malloc: out of memory in %s\n",
+                                 memp_desc[type]));
 #if MEMP_STATS
     ++lwip_stats.memp[type].err;
 #endif /* MEMP_STATS */
-- 
1.5.2.1







reply via email to

[Prev in Thread] Current Thread [Next in Thread]