Lines Matching refs:mem

48 	struct tp_mem *mem = k_malloc(sizeof(struct tp_mem) + size +  in tp_malloc()  local
49 sizeof(*mem->footer)); in tp_malloc()
51 mem->file = file; in tp_malloc()
52 mem->line = line; in tp_malloc()
53 mem->func = func; in tp_malloc()
55 mem->size = size; in tp_malloc()
57 mem->header = TP_MEM_HEADER_COOKIE; in tp_malloc()
59 mem->footer = (void *) ((uint8_t *) &mem->mem + size); in tp_malloc()
60 *mem->footer = TP_MEM_FOOTER_COOKIE; in tp_malloc()
62 sys_slist_append(&tp_mem, (sys_snode_t *) mem); in tp_malloc()
64 return &mem->mem; in tp_malloc()
86 void tp_mem_chk(struct tp_mem *mem) in tp_mem_chk() argument
88 if (mem->header != TP_MEM_HEADER_COOKIE || in tp_mem_chk()
89 *mem->footer != TP_MEM_FOOTER_COOKIE) { in tp_mem_chk()
92 mem->file, mem->line, mem->func, mem->mem, mem->size); in tp_mem_chk()
94 dump(&mem->header, sizeof(mem->header)); in tp_mem_chk()
95 dump(mem->mem, mem->size); in tp_mem_chk()
96 dump(mem->footer, sizeof(*mem->footer)); in tp_mem_chk()
98 tp_assert(mem->header == TP_MEM_HEADER_COOKIE, in tp_mem_chk()
100 mem->file, mem->line, mem->func, mem->mem, in tp_mem_chk()
101 mem->header); in tp_mem_chk()
103 tp_assert(*mem->footer == TP_MEM_FOOTER_COOKIE, in tp_mem_chk()
105 mem->file, mem->line, mem->func, mem->mem, in tp_mem_chk()
106 *mem->footer); in tp_mem_chk()
112 struct tp_mem *mem = (void *)((uint8_t *) ptr - sizeof(struct tp_mem)); in tp_free() local
114 tp_mem_chk(mem); in tp_free()
116 if (!sys_slist_find_and_remove(&tp_mem, (sys_snode_t *) mem)) { in tp_free()
121 memset(mem, 0, sizeof(tp_mem) + mem->size + sizeof(*mem->footer)); in tp_free()
122 k_free(mem); in tp_free()
138 struct tp_mem *mem; in tp_mem_stat() local
140 SYS_SLIST_FOR_EACH_CONTAINER(&tp_mem, mem, next) { in tp_mem_stat()
141 tp_dbg("len=%zu %s:%d", mem->size, mem->file, mem->line); in tp_mem_stat()
142 tp_mem_chk(mem); in tp_mem_stat()