Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions include/nuttx/kmalloc.h
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,8 @@ extern "C"
*
****************************************************************************/

struct task_group_s;

/* Functions defined in group/group_malloc.c ********************************/

FAR void *group_malloc(FAR struct task_group_s *group, size_t nbytes);
Expand Down
3 changes: 2 additions & 1 deletion mm/mm_heap/mm_foreach.c
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,8 @@ void mm_foreach(FAR struct mm_heap_s *heap, mm_node_handler_t handler,

handler(node, arg);

DEBUGASSERT(MM_PREVNODE_IS_ALLOC(node) ||
DEBUGASSERT(prev == NULL ||
MM_PREVNODE_IS_ALLOC(node) ||
MM_SIZEOF_NODE(prev) == node->preceding);
prev = node;
}
Expand Down
26 changes: 19 additions & 7 deletions mm/mm_heap/mm_memdump.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@

struct mm_memdump_priv_s
{
FAR const struct mm_memdump_s *dump;
struct mm_memdump_s dump;
struct mallinfo_task info;
#if CONFIG_MM_HEAP_BIGGEST_COUNT > 0
FAR struct mm_allocnode_s *node[CONFIG_MM_HEAP_BIGGEST_COUNT];
Expand Down Expand Up @@ -86,9 +86,9 @@ static void memdump_allocnode(FAR struct mm_allocnode_s *node)

syslog(LOG_INFO, "%6d%12zu%9zu"
# ifdef CONFIG_MM_BACKTRACE_SEQNO
"%12lu%"
"%12lu"
# endif
"*p %s\n",
"%*p %s\n",
node->pid, nodesize, overhead,
# ifdef CONFIG_MM_BACKTRACE_SEQNO
node->seqno,
Expand Down Expand Up @@ -154,7 +154,7 @@ static inline_function
void memdump_info_pool(FAR struct mm_memdump_priv_s *priv,
FAR struct mm_heap_s *heap)
{
priv->info = mempool_multiple_info_task(heap->mm_mpool, priv->dump);
priv->info = mempool_multiple_info_task(heap->mm_mpool, &priv->dump);
}

static inline_function
Expand All @@ -163,7 +163,7 @@ void memdump_dump_pool(FAR struct mm_memdump_priv_s *priv,
{
if (priv->info.aordblks > 0)
{
mempool_multiple_memdump(heap->mm_mpool, priv->dump);
mempool_multiple_memdump(heap->mm_mpool, &priv->dump);
}
}
#else
Expand All @@ -174,7 +174,7 @@ void memdump_dump_pool(FAR struct mm_memdump_priv_s *priv,
static void memdump_handler(FAR struct mm_allocnode_s *node, FAR void *arg)
{
FAR struct mm_memdump_priv_s *priv = arg;
FAR const struct mm_memdump_s *dump = priv->dump;
FAR const struct mm_memdump_s *dump = &priv->dump;
size_t nodesize = MM_SIZEOF_NODE(node);

if (MM_NODE_IS_ALLOC(node))
Expand Down Expand Up @@ -251,7 +251,19 @@ void mm_memdump(FAR struct mm_heap_s *heap,
pid_t pid = dump->pid;

memset(&priv, 0, sizeof(struct mm_memdump_priv_s));
priv.dump = dump;
priv.dump.pid = pid;

#ifdef CONFIG_MM_BACKTRACE_SEQNO
if (dump->seqmin == 0 && dump->seqmax == 0)
{
priv.dump.seqmax = ULONG_MAX;
}
else
{
priv.dump.seqmin = dump->seqmin;
priv.dump.seqmax = dump->seqmax;
}
#endif

if (pid == PID_MM_MEMPOOL)
{
Expand Down
22 changes: 17 additions & 5 deletions mm/tlsf/mm_tlsf.c
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ struct mm_tlsf_node_s

struct mm_memdump_priv_s
{
FAR const struct mm_memdump_s *dump;
struct mm_memdump_s dump;
struct mallinfo_task info;
#if CONFIG_MM_HEAP_BIGGEST_COUNT > 0
struct mm_tlsf_node_s node[CONFIG_MM_HEAP_BIGGEST_COUNT];
Expand All @@ -185,7 +185,7 @@ static inline_function
void memdump_info_pool(FAR struct mm_memdump_priv_s *priv,
FAR struct mm_heap_s *heap)
{
priv->info = mempool_multiple_info_task(heap->mm_mpool, priv->dump);
priv->info = mempool_multiple_info_task(heap->mm_mpool, &priv->dump);
}

static inline_function
Expand All @@ -194,7 +194,7 @@ void memdump_dump_pool(FAR struct mm_memdump_priv_s *priv,
{
if (priv->info.aordblks > 0)
{
mempool_multiple_memdump(heap->mm_mpool, priv->dump);
mempool_multiple_memdump(heap->mm_mpool, &priv->dump);
}
}
#else
Expand Down Expand Up @@ -696,7 +696,7 @@ static void memdump_handler(FAR void *ptr, size_t size, int used,
FAR void *user)
{
FAR struct mm_memdump_priv_s *priv = user;
FAR const struct mm_memdump_s *dump = priv->dump;
FAR struct mm_memdump_s *dump = &priv->dump;

if (used)
{
Expand Down Expand Up @@ -1335,7 +1335,19 @@ void mm_memdump(FAR struct mm_heap_s *heap,
pid_t pid = dump->pid;

memset(&priv, 0, sizeof(struct mm_memdump_priv_s));
priv.dump = dump;

#ifdef CONFIG_MM_BACKTRACE_SEQNO
if (dump->seqmin == 0 && dump->seqmax == 0)
{
priv.dump.seqmin = 0;
priv.dump.seqmax = ULONG_MAX;
}
else
{
priv.dump.seqmin = dump->seqmin;
priv.dump.seqmax = dump->seqmax;
}
#endif

free_delaylist(heap, true);

Expand Down
Loading