mimalloc icon indicating copy to clipboard operation
mimalloc copied to clipboard

Segment size calculations may have overflows

Open Zoxc opened this issue 10 months ago • 1 comments

The code for segment size calculation (on master) seemed quite sketchy and hard to understand. In particular it lacks overflow checks. I forgot to report the issue when I noticed it, so the details are a bit paged out.

I ended up just rewriting it in my Rust port: https://github.com/Zoxc/fjall/blob/main/src/segment.rs#L549

Zoxc avatar Feb 01 '25 05:02 Zoxc

Thanks! I will take a closer look and improve it.

Btw. thanks for your previous suggestions which have improved mimalloc.

ps. I don't want to derail your current effort to port mimalloc to rust, but recently we improved mimalloc quite a bit in the dev3 branch -- still a bit experimental but it is much simplified : no more segments, and a much cleaner concurrent model. This version shares memory between threads better (on a page level) and may be better suited for rust. It is still a bit in flux though.

daanx avatar Feb 10 '25 02:02 daanx