casaroli commented on code in PR #21037:
URL: https://github.com/apache/nuttx/pull/21037#discussion_r4391677647
##########
mm/mempool/mempool_multiple.c:
##########
@@ -596,6 +597,15 @@ FAR void *mempool_multiple_realloc(FAR struct
mempool_multiple_s *mpool,
return NULL;
}
+ blkbase = (FAR char *)oldblk -
+ (((FAR char *)kasan_clear_tag(oldblk) -
+ ((FAR char *)kasan_clear_tag(dict->addr) +
+ mpool->minpoolsize)) % MEMPOOL_REALBLOCKSIZE(dict->pool));
+ if (size > 0 && size <= dict->pool->blocksize && blkbase == oldblk)
Review Comment:
`size <= dict->pool->blocksize` also matches a shrink to a smaller size
class: before, realloc(p, 16) on a 512-byte block moved the data to the 16-byte
pool and freed the 512-byte block; now the 512-byte block stays in use. The
commit message says "same size class"; to keep the old memory use, compare
mempool_multiple_find(mpool, size) with dict->pool.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]