# Is custom allocators the right abstraction?

**URL:** <https://internals.rust-lang.org/t/is-custom-allocators-the-right-abstraction/13460>\
**Category:** libs\
**Created:** [November 28, 2020, 4:14pm UTC](https://internals.rust-lang.org/t/is-custom-allocators-the-right-abstraction/13460 "2020-11-28T16:14:15Z")\
**Posts on this page:** 1\
**Showing post:** 88

<div class="post-metadata">

**Author:** ![irrst](https://sea2.discourse-cdn.com/flex002/user_avatar/internals.rust-lang.org/irrst/32/7944_2.png) [@irrst](https://internals.rust-lang.org/u/irrst)\
**Post date:** [April 7, 2021, 4:30pm UTC](https://internals.rust-lang.org/t/is-custom-allocators-the-right-abstraction/13460/88 "2021-04-07T16:30:41Z")

</div>

I was experimenting with my own PoC for the storage API and I found some things I wanted to share, mention and discuss here.

As I'm not a native english speaker, fell free to ask me if you can't understand some parts! 😉

So these are what I have thought about:

- The distinction between Single\* and Multi\* storage isn't really needed. In general, `Storage` stores information (or inline storage) shared across all allocations and `Handle` stores information about one specific allocation. But for Single\* storages, this distinction is unnecessary because there is no shared information (or shared inline storage) at all. We can actually store everything in handle which would allow that there are many alive handles at any time - which would in turn erase the need for Single\* storage.

- There are some problems with the current typed `Storage` API:

- Currently, we can do nothing with an allocated handle; we need to first acquire the underlying pointer (which may change at any time) to do operations with the memory itself.

Maybe these questions were not needed right now because the current storage proposal is only at the PoC stage; but I think the earlier we raise up unresolved questions, the better we can answer those.

@matthieum: What do you think about this?

* * *

As a side note, thanks for this awesome proposal and working on this kind of stuffs!

---

_[View the full topic](https://internals.rust-lang.org/t/is-custom-allocators-the-right-abstraction/13460)._
