purpleprotocol / mimalloc_rust

A Rust wrapper over Microsoft's MiMalloc memory allocator
MIT License
486 stars 42 forks source link

Expose most of mimalloc API from libmimalloc-sys #32

Closed thomcc closed 3 years ago

thomcc commented 4 years ago

Fixes #31. Comes with tests, more CI, and docs.

This goes on top of #30 since it improves the CI. It also includes the fix for #29 which is a one-liner and is required to make the tests pass.

Once #30 that lands I'll rebase and the commits from it should go away, and if you like the look at this I can close #29 and just let it get subsumed.

This splits stuff into an "extended" API (activated by a feature) and a default API. This is a bit odd, since it's not really on a good/deliberate boundary.

I think perhaps a better boundary would be:

As it is it's kind of weird that it includes mi_zalloc or mi_usable_size in the "core", but mi_calloc is part of the extended api. That said, the code is probably fine as-is -- it would be breaking to move public stuff behind a feature, and really there's little benefit to it, so it seems fine, just odd.

What this skips:

I'm not that attached to most of the things on this list, and would be willing to add them either now or in the future as-needed.

Anyway, the following parts of the API are intentionally not exposed because they

I think that's it.


Looking at it again, zero initialized re-allocation is probably worth adding -- it's a low level API and that can help. It's easy to misuse, but that's why it's unsafe.

Hrm.

thomcc commented 4 years ago

Gentle ping :)

octavonce commented 3 years ago

@thomcc Sorry for taking so long. I have had the busiest times of my life in the past month and I wanted to take the time to review these properly.

29 and #30 are now merged. I believe a rebase from you should do the trick for this one. Very well done with these changes!

octavonce commented 3 years ago

This looks great! Merging now...