Closed DazzlingOkami closed 3 weeks ago
Hi @DazzlingOkami , Thanks for raising the bug. Will it be ok for you to create a PR as well for the same.
I will try to fix it.
Thanks @DazzlingOkami for the contribution ! The PR #1089 has been verified to solve the aforementioned issue , approved and merged in the main code.
Describe the bug In the implementation of heap4.
Use traceMALLOC() to track that the number of memory bytes allocated is less than the actual amount allocated. At the same time, it will cause the count of traceMALLOC() and traceFREE() to be unequal.
When searching for an available free block, if the remaining length after partitioning is too short, the free block is not split, resulting in the actual allocated memory length being greater than xWantedSize. However, traceMALLOC() seems to ignore this and xWantedSize has not been adjusted appropriately.
Target
To Reproduce Construct test code:
output log:
clearly seen that the total number is not equal.
Expected behavior The total number of allocations and releases should be equal.
Additional context Consider modifying xWantedSize to the size of a free block when not split blocks.