nuttx
nuttx copied to clipboard
mempool:change sq to dq,free to head, alloc form tail
Summary
Mempool:Change single queue to double queue and add more checks
Impact
mempool
Testing
sim with mm_testing & mempool
add santiy check for used after free Using a double linked queue can allow the free memory to be malloced out in the end. Use tools (Kasan) as much as possible to check the memory stampede problem without causing speed reduction or memory usage.
@anjiahao1 please add a little bit more information in the commit log message. Please explain the main motivation of this modification.
@xiaoxiang781216 @anjiahao1 @davids5 @raiden00pl @patacongo is there some alternative to avoid declaring these functions inside a function? I'm afraid it is not C89 compatible.
@xiaoxiang781216 @anjiahao1 @davids5 @raiden00pl @patacongo is there some alternative to avoid declaring these functions inside a function? I'm afraid it is not C89 compatible.
What do you mean "function inside a function"? The violation I can find is inline
. I would say that it's very bad idea to disallow the using of inline.
@xiaoxiang781216 @anjiahao1 @davids5 @raiden00pl @patacongo is there some alternative to avoid declaring these functions inside a function? I'm afraid it is not C89 compatible.
What do you mean "function inside a function"? The violation I can find is
inline
. I would say that it's very bad idea to disallow the using of inline.
That:
dq_for_every(queue, entry)
{
count++;
}
I don't see it usually in the source code, I don't know exactly what is it. I only found that dq_for_every() inside this python script: tools/gdb/lists.py
What is it? What is it used for?
dq_for_every is a new macro added in this patch:
just simply forward to sq_for_every macro which expand to a for loop.
dq_for_every is a new macro added in this patch:
just simply forward to sq_for_every macro which expand to a for loop.
Ok, now I got the idea, of each run in this loop it will run the code inside "{ }", in this case count++.