Re: debugging mm_free debugassert()

2020-06-21 Thread Gregory Nutt




Ok, I will try that.
If I enable stackchecking should this kind of stack overrun be catched?


Probably.  The assertion output should should the stack usage of every 
active task in that case.


There are lots of ways that memory corruption can occur.  Stack overrun 
is just one common cause.  And one that would make sense in this case 
because it seems only to be effecting your configuration.




Re: debugging mm_free debugassert()

2020-06-21 Thread Matias N.
Ok, I will try that.
If I enable stackchecking should this kind of stack overrun be catched?

On Sun, Jun 21, 2020, at 14:22, Gregory Nutt wrote:
> 
> > The most common cause... in fact the only cause that I am aware of ... 
> > for heap failure is memory corruption. 
> 
> And a very common cause of heap memory corruption is a task that has 
> overrun its stack and clobber the meta data at the beginning of the next 
> chunk.
> 
> A simple thing you can do is to bump up stack sizes to assure this is 
> common case is not the cause of your problem.
> 
> 


Re: debugging mm_free debugassert()

2020-06-21 Thread Gregory Nutt



The most common cause... in fact the only cause that I am aware of ... 
for heap failure is memory corruption. 


And a very common cause of heap memory corruption is a task that has 
overrun its stack and clobber the meta data at the beginning of the next 
chunk.


A simple thing you can do is to bump up stack sizes to assure this is 
common case is not the cause of your problem.




Re: debugging mm_free debugassert()

2020-06-21 Thread Gregory Nutt



I'm having a weird bug appear during boot. It is being triggered at 
the first call of mm_free which comes from a call to mtdconfig driver. 
I have enabled debug information and I'm also debugging at the point 
before crash but since I don't understand the memory manager I can't 
tell where this is coming from.

The assertion line is (mm_free.c:185):

DEBUGASSERT((node->preceding & ~MM_ALLOC_BIT) == prev->size);


The most common cause... in fact the only cause that I am aware of ... 
for heap failure is memory corruption.


I normally debug this bay calling mallinfo() has selected places.  If 
the heap has been corrupted mallinfo() will fail. With a little effort 
you can find the cause of the failure between the last good call to 
mallinfo() and the first failed call to mallinfo().