mirror of
https://github.com/obgm/libcoap.git
synced 2026-12-05 20:02:19 +03:00
memory: Support debug tracking of memory usage
New function coap_dump_memory_type_counts(). Requires COAP_MEMORY_TYPE_TRACK to be defined as 1.
This commit is contained in:
1 parent
7688258c39
commit
17e44c73df
5 files changed
+161
-8
No files matched your search
@@ -64,6 +64,7 @@ typedef enum {
|
||||
COAP_OSCORE_EP,
|
||||
COAP_OSCORE_BUF,
|
||||
COAP_COSE,
|
||||
COAP_MEM_TAG_LAST
|
||||
} coap_memory_tag_t;
|
||||
|
||||
#ifndef WITH_LWIP
|
||||
@@ -106,6 +107,15 @@ void *coap_realloc_type(coap_memory_tag_t type, void *p, size_t size);
|
||||
*/
|
||||
void coap_free_type(coap_memory_tag_t type, void *p);
|
||||
|
||||
/**
|
||||
* Dumps the current usage of malloc'd memory types.
|
||||
*
|
||||
* Requires COAP_MEMORY_TYPE_TRACK to be defined to 1.
|
||||
*
|
||||
* @param log_level The logging level to use.
|
||||
*/
|
||||
void coap_dump_memory_type_counts(coap_log_t log_level);
|
||||
|
||||
/**
|
||||
* Wrapper function to coap_malloc_type() for backwards compatibility.
|
||||
*/
|
||||
@@ -161,6 +171,8 @@ coap_free(void *pointer) {
|
||||
LWIP_ASSERT("coap_free must not be used in lwIP", 0);
|
||||
}
|
||||
|
||||
#define coap_dump_memory_type_counts(l) coap_lwip_dump_memory_pools(l)
|
||||
|
||||
#endif /* WITH_LWIP */
|
||||
|
||||
#endif /* COAP_MEM_H_ */
|
||||
Reference in new issue
Block a user