Skip to content

Commit b524018

Browse files
committed
[mem]When using SLAB, calls to memcheck and memtrace will be abnormal
1 parent 75f4172 commit b524018

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

src/mem.c

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2006-2022, RT-Thread Development Team
2+
* Copyright (c) 2006-2024, RT-Thread Development Team
33
*
44
* SPDX-License-Identifier: Apache-2.0
55
*
@@ -565,9 +565,16 @@ static int memcheck(int argc, char *argv[])
565565
object = rt_list_entry(node, struct rt_object, list);
566566
/* find the specified object */
567567
if (name != RT_NULL && rt_strncmp(name, object->name, RT_NAME_MAX) != 0)
568+
{
568569
continue;
570+
}
569571
/* mem object */
570572
m = (struct rt_small_mem *)object;
573+
if(rt_strncmp(m->parent.algorithm, "small", RT_NAME_MAX) != 0)
574+
{
575+
continue;
576+
}
577+
571578
/* check mem */
572579
for (mem = (struct rt_small_mem_item *)m->heap_ptr; mem != m->heap_end; mem = (struct rt_small_mem_item *)&m->heap_ptr[mem->next])
573580
{
@@ -611,9 +618,15 @@ static int memtrace(int argc, char **argv)
611618
object = rt_list_entry(node, struct rt_object, list);
612619
/* find the specified object */
613620
if (name != RT_NULL && rt_strncmp(name, object->name, RT_NAME_MAX) != 0)
621+
{
614622
continue;
623+
}
615624
/* mem object */
616625
m = (struct rt_small_mem *)object;
626+
if(rt_strncmp(m->parent.algorithm, "small", RT_NAME_MAX) != 0)
627+
{
628+
continue;
629+
}
617630
/* show memory information */
618631
rt_kprintf("\nmemory heap address:\n");
619632
rt_kprintf("name : %s\n", m->parent.parent.name);

0 commit comments

Comments
 (0)