microsoft / mimalloc

mimalloc is a compact general purpose allocator with excellent performance.
MIT License
9.74k stars 793 forks source link

Code comment for `mi_page_t.used` possibly incorrect #861

Closed colesbury closed 4 months ago

colesbury commented 4 months ago

The comment for the used field in mi_page_t says it includes "blocks in local_free and thread_free". I think the used field only includes the blocks in thread_free, but not local_free.

In other words, blocks in thread_free are counted as in-use, but blocks in free and local_free are not counted as in-use.

https://github.com/microsoft/mimalloc/blob/da520480254b8af2ff9d7bf413d92c46c6db52dd/include/mimalloc/types.h#L298

daanx commented 4 months ago

Hi Sam, thanks -- you are right! I'll fix it up.