143 |
|
|
144 |
#ifdef MEMP_STATS |
#ifdef MEMP_STATS |
145 |
for(i = 0; i < MEMP_MAX; ++i) { |
for(i = 0; i < MEMP_MAX; ++i) { |
146 |
stats.memp[i].used = stats.memp[i].max = |
lwip_stats.memp[i].used = lwip_stats.memp[i].max = |
147 |
stats.memp[i].err = 0; |
lwip_stats.memp[i].err = 0; |
148 |
stats.memp[i].avail = memp_num[i]; |
lwip_stats.memp[i].avail = memp_num[i]; |
149 |
} |
} |
150 |
#endif /* MEMP_STATS */ |
#endif /* MEMP_STATS */ |
151 |
|
|
187 |
memp_tab[type] = memp->next; |
memp_tab[type] = memp->next; |
188 |
memp->next = NULL; |
memp->next = NULL; |
189 |
#ifdef MEMP_STATS |
#ifdef MEMP_STATS |
190 |
++stats.memp[type].used; |
++lwip_stats.memp[type].used; |
191 |
if(stats.memp[type].used > stats.memp[type].max) { |
if(lwip_stats.memp[type].used > lwip_stats.memp[type].max) { |
192 |
stats.memp[type].max = stats.memp[type].used; |
lwip_stats.memp[type].max = lwip_stats.memp[type].used; |
193 |
} |
} |
194 |
#endif /* MEMP_STATS */ |
#endif /* MEMP_STATS */ |
195 |
ASSERT("memp_malloc: memp properly aligned", |
ASSERT("memp_malloc: memp properly aligned", |
202 |
} else { |
} else { |
203 |
DEBUGF(MEMP_DEBUG, ("memp_malloc: out of memory in pool %d\n", type)); |
DEBUGF(MEMP_DEBUG, ("memp_malloc: out of memory in pool %d\n", type)); |
204 |
#ifdef MEMP_STATS |
#ifdef MEMP_STATS |
205 |
++stats.memp[type].err; |
++lwip_stats.memp[type].err; |
206 |
#endif /* MEMP_STATS */ |
#endif /* MEMP_STATS */ |
207 |
return NULL; |
return NULL; |
208 |
} |
} |
253 |
memp = (struct memp *)((u8_t *)mem - sizeof(struct memp)); |
memp = (struct memp *)((u8_t *)mem - sizeof(struct memp)); |
254 |
|
|
255 |
#ifdef MEMP_STATS |
#ifdef MEMP_STATS |
256 |
stats.memp[type].used--; |
lwip_stats.memp[type].used--; |
257 |
#endif /* MEMP_STATS */ |
#endif /* MEMP_STATS */ |
258 |
|
|
259 |
memp->next = memp_tab[type]; |
memp->next = memp_tab[type]; |